mirror of
https://github.com/django/django.git
synced 2025-11-14 09:17:36 +00:00
Fixed #24285 -- Made for_user argument optional for {% get_admin_log %} tag
This commit is contained in:
parent
35b3158d52
commit
eb5ebcc2d0
2 changed files with 23 additions and 4 deletions
|
|
@ -13,14 +13,13 @@ class AdminLogNode(template.Node):
|
|||
|
||||
def render(self, context):
|
||||
if self.user is None:
|
||||
context[self.varname] = LogEntry.objects.all().select_related('content_type', 'user')[:self.limit]
|
||||
entries = LogEntry.objects.all()
|
||||
else:
|
||||
user_id = self.user
|
||||
if not user_id.isdigit():
|
||||
user_id = context[self.user].pk
|
||||
context[self.varname] = LogEntry.objects.filter(
|
||||
user__pk=user_id,
|
||||
).select_related('content_type', 'user')[:int(self.limit)]
|
||||
entries = LogEntry.objects.filter(user__pk=user_id)
|
||||
context[self.varname] = entries.select_related('content_type', 'user')[:int(self.limit)]
|
||||
return ''
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue