Okay, this seems to produce TypeError in Django 2.0. See here:
https://code.djangoproject.com/ticket/22550
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving
I am facing this on Django 1.9, Python 2.7
On Mon, Sep 24, 2018 at 5:42 PM Vasili Korol wrote:
> I can confirm this issue on Django 1.11.15 (Python 3.4.3, MySQL 5.5.61).
> Calling 'last()' on a slice produces wrong result:
>
> >>> News.objects.all().order_by('id')[:5].values('id')
>
>
> >>> New
I can confirm this issue on Django 1.11.15 (Python 3.4.3, MySQL 5.5.61).
Calling 'last()' on a slice produces wrong result:
>>> News.objects.all().order_by('id')[:5].values('id')
>>> News.objects.all().order_by('id')[:5][4].id
5
>>> #But calling 'last' gives us wrong id:
>>> News.objects.all()
Hi,
I am making a queryset by slicing it to return only first 2 objects but
When I am using .last() on this queryset then it is not applying slicing
Pharmaceutical.objects.order_by('id').values('id')
>>> [{'id': 2L}, {'id': 3L}, {'id': 4L}, {'id': 5L}]
>>> Pharmaceutical.objects.order_by('id')[: