#27405: AdminLogNode render TypeError exception while calling get_admin_log 
with no
user (1.8.x)
-------------------------------------+-------------------------------------
               Reporter:  Ihor       |          Owner:  nobody
  Polyakov                           |
                   Type:  Bug        |         Status:  new
              Component:             |        Version:  1.8
  contrib.admin                      |       Keywords:  exception,
               Severity:  Normal     |  TypeError, log, TypeError
           Triage Stage:             |      Has patch:  1
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 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

--
Ticket URL: <https://code.djangoproject.com/ticket/27405>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/048.8bc44bb61ae9295bc5899c05580619d2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to