How is this possible?

# we start with a queryset actual_events

# get forthcoming_events using filter()

forthcoming_events = actual_events.filter(  
    Q(single_day_event = True, date__gte = datetime.now()) | \
    Q(single_day_event = False, end_date__gte = datetime.now())
    )

# get previous_events using exclude() and exactly the same terms as above

previous_events = actual_events.exclude(  
    Q(single_day_event = True, date__gte = datetime.now()) | \
    Q(single_day_event = False, end_date__gte = datetime.now())
    )

# And now:

# actual_events.count():      467
# forthcoming_events.count():  24
# previous_events.count():    442

SInce I have run .filter() and .exclude() with identical terms, should they not 
between them contain all the items in the queryset they acted upon, *whatever* 
the terms used?

Daniele

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to