Opened 4 years ago
Closed 4 years ago
#32830 closed Bug (invalid)
The 'last' filter in django template default tags give negative index error
| Reported by: | sushantg2001 | Owned by: | sushantg2001 |
|---|---|---|---|
| Component: | Template system | Version: | 3.2 |
| Severity: | Normal | Keywords: | last django-template |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
The 'last' filter in django template default tags give negative index error. This is because the code uses negative indexing to get the value which are not supported by RelatedManager querysets
Change History (2)
comment:1 by , 4 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:2 by , 4 years ago
| Resolution: | → invalid |
|---|---|
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
The
lasttemplate filter is not intended to work with a queryset but with a list, see docs. You can use{{ queryset.last }}, which will call QuerySet.last().