I was surprised, that comparing querysets does not work:
{{{
from django.contrib.auth.models import User
user_id=User.objects.all().order_by('id')[0].id
if not User.objects.filter(id=user_id)==User.objects.filter(id=user_id):
print 'Not equal? I think they should be'
ids1=User.objects.filter(id=user_id).values_list('id', flat=True)
ids2=User.objects.filter(id=user_id).values_list('id', flat=True)
if not ids1==ids2:
print 'Not equal? I think they should be: %s %s' % (ids1, ids2)
}}}
Both, django 1.3 and 1.4 print this result:
Not equal? I think they should be
Not equal? I think they should be: [1] [1]
I could not find a documentation of this in the django docs[1].
Before creating a doc-ticket I want to ask here.
[1] https://docs.djangoproject.com/en/dev/ref/models/querysets/
--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
--
You received this message because you are subscribed to the Google Groups "Django
users" 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-users?hl=en.