diff --git a/django/contrib/admin/templatetags/log.py b/django/contrib/admin/templatetags/log.py index 84c7e6c7a6..36f40f1942 100644 --- a/django/contrib/admin/templatetags/log.py +++ b/django/contrib/admin/templatetags/log.py @@ -14,9 +14,10 @@ class AdminLogNode(template.Node): if self.user is None: context[self.varname] = LogEntry.objects.all().select_related('content_type', 'user')[:self.limit] else: - if not self.user.isdigit(): - self.user = context[self.user].id - context[self.varname] = LogEntry.objects.filter(user__id__exact=self.user).select_related('content_type', 'user')[:self.limit] + user_id = self.user + if not user_id.isdigit(): + user_id = context[self.user].id + context[self.varname] = LogEntry.objects.filter(user__id__exact=user_id).select_related('content_type', 'user')[:self.limit] return '' class DoGetAdminLog: