>>> Entry.objects.filter(
... headline__startswith='What'
... ).exclude(
... pub_date__gte=datetime.now()
... ).filter(
... pub_date__gte=datetime(2005, 1, 1)
... )
"This takes the initial QuerySet of all entries in the database, adds a filter, then an exclusion, then another filter. The final result is a QuerySet containing all entries with a headline that starts with “What”, that were published between January 1, 2005, and the current day."
Can someone explain what is the __ and the word gte doing in this context. I cannot visualize how the above query extracts the range between January 1, 2005, and the current day since we are excluding datetime.now . I am sure it is relating to something that I am missing regarding the double underscore and gte. Thanks.