Django: Getting Started Transcripts
Chapter: Django ORM and Databases
Lecture: Comparison queries such as greater than
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Importing and running a filter query and the resulting query set now has more detail in it. Same goes with a get but of course,
0:12
because I didn't add a Dunder string method to author, you will still get the default when you access the author attribute of the book.
0:21
That author attribute is as good as an instance of the author object. I can get at its fields directly here.
0:31
Seeing as I'm here, let's try one more query. Want to guess what this one did.
0:39
Django uses the double underscore as a way of triggering comparison operators. This filter query says, give me all the books whose ids are greater
0:48
than that's the GT 1. That'd be books two and 3, of course.