#17523: Slicing: EmptyQuerySet behaves differently from QuerySet
-------------------------------+--------------------
Reporter: rluedeman | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.3
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I noticed a slight (but annoying) difference between slicing an
EmptyQuerySet and slicing a standard QuerySet. It seems like slicing an
EmptyQuerySet should return an EmptyQuerySet, rather than returning a
list.
Example:
{{{
>> from django.contrib.auth.models import User
>>
>> type(User.objects.all())
<class 'django.db.models.query.QuerySet'>
>> type(User.objects.all()[:0])
<class 'django.db.models.query.QuerySet'>
>> type(User.objects.all()[:10])
<class 'django.db.models.query.QuerySet'>
>>
>> type(User.objects.none())
<class 'django.db.models.query.EmptyQuerySet'>
>> type(User.objects.none()[:0])
<type 'list'>
>> type(User.objects.none()[:10])
<type 'list'>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/17523>
Django <https://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.