#32830: The 'last' filter in django template default tags give negative index 
error
-------------------------------------+-------------------------------------
     Reporter:  sushantg2001         |                    Owner:
                                     |  sushantg2001
         Type:  Bug                  |                   Status:  closed
    Component:  Template system      |                  Version:  3.2
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  last django-         |             Triage Stage:
  template                           |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

 * status:  assigned => closed
 * resolution:   => invalid


Comment:

 The `last` template filter is not intended to work with a queryset but
 with a list, see
 [https://docs.djangoproject.com/en/3.2/ref/templates/builtins/#last docs].
 You can use `{{ queryset.last }}`, which will call
 [https://docs.djangoproject.com/en/3.2/ref/models/querysets/#last
 QuerySet.last()].

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32830#comment:2>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.7056e0be4702d213cde0735c268707c0%40djangoproject.com.

Reply via email to