#6026: strange behavior of exclude() and multiple fields
----------------------------------------------------------+-----------------
Reporter: Michael Samoylov <[EMAIL PROTECTED]> | Owner: nobody
Status: new | Component:
Database wrapper
Version: 0.96 | Keywords:
Stage: Unreviewed | Has_patch: 0
----------------------------------------------------------+-----------------
{{{
class Consumer(models.Model):
user = models.ForeignKey(User, core=True, editable=False)
[skipped]
class Trip(models.Model):
consumer = models.ForeignKey(Consumer, related_name='consumer',
blank=True, null=True, editable=False)
legacy = models.BooleanField(default=False) # used to flag old-style
trip
[skipped]
}}}
{{{
>>> for t in Trip.objects.exclude(legacy=True):
... if t.legacy is True:
... print t.id
... break
...
>>> for t in
Trip.objects.exclude(consumer__user__email__contains='@yahoo.com ',
legacy=True):
... if t.legacy is True:
... print t.id
... break
...
34933
>>> for t in
Trip.objects.exclude(consumer__user__email__icontains='@yahoo.com',
legacy=True):
... if t.legacy is True:
... print t.id
... break
...
34933
>>> for t in Trip.objects.exclude
(consumer__user__email__endswith='@yahoo.com', legacy=True):
... if t.legacy is True:
... print t.id
... break
...
34933
>>> for t in Trip.objects.exclude(duration=1, legacy=True):
... if t.legacy is True:
... print t.id
... break
...
>>>
>>> for t in
Trip.objects.filter(consumer__user__email__endswith='@yahoo.com',
legacy=False):
... if t.legacy is True:
... print t.id
... break
...
>>>
>>> for t in
Trip.objects.exclude(consumer__user__email__endswith='@yahoo.com').exclude(legacy=True):
... if t.legacy is True:
... print t.id
... break
...
>>>
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/6026>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---