Opened 8 years ago

Closed 8 years ago

#27405 closed Bug (wontfix)

AdminLogNode render TypeError exception while calling get_admin_log with no user (1.8.x)

Reported by: Ihor Polyakov Owned by: Ihor Polyakov
Component: contrib.admin Version: 1.8
Severity: Normal Keywords: exception, TypeError, log, TypeError
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If I call in template:
{% get_admin_log 10 as admin_log %} (without for_user user):
it will throw an exception: TypeError: slice indices must be integers
from this line (django/contrib/admin/templatetags/log.py):
context[self.varname] = LogEntry.objects.all().select_related('content_type', 'user')[:self.limit]
because self.limit was not wrapped with int function like it is in other if statement branch:
...).select_related('content_type', 'user')[:int(self.limit)]

My simple fix is here:
https://github.com/django/django/pull/7453

Change History (2)

comment:1 by Ihor Polyakov, 8 years ago

Owner: changed from nobody to Ihor Polyakov
Status: newassigned

comment:2 by Tim Graham, 8 years ago

Resolution: wontfix
Status: assignedclosed

Per our supported versions policy, 1.8 is only receiving security fixes.

Note: See TracTickets for help on using tickets.
Back to Top