diff options
author | Jacob Rief <jacob.rief@gmail.com> | 2023-02-08 18:37:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-08 18:37:32 +0100 |
commit | 473283d2414fa4bbf1e38d663fe4a58f49bf72b9 (patch) | |
tree | 63e9f30aff3a6b95e47d3e737750e863644945e0 /tests/admin_changelist | |
parent | 1964e4367f293336b47e30af6e10a5eca5fdfb35 (diff) | |
download | django-473283d2414fa4bbf1e38d663fe4a58f49bf72b9.tar.gz |
Fixed #34303 –- Allowed customizing admin site log entry list.
Added AdminSite.get_log_entries() as an override point and made this
available to the template via each_context().
Diffstat (limited to 'tests/admin_changelist')
-rw-r--r-- | tests/admin_changelist/tests.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py index a2db24fea1..413d6d4d7f 100644 --- a/tests/admin_changelist/tests.py +++ b/tests/admin_changelist/tests.py @@ -1595,7 +1595,12 @@ class GetAdminLogTests(TestCase): {% get_admin_log %} works if the user model's primary key isn't named 'id'. """ - context = Context({"user": CustomIdUser()}) + context = Context( + { + "user": CustomIdUser(), + "log_entries": LogEntry.objects.all(), + } + ) template = Template( "{% load log %}{% get_admin_log 10 as admin_log for_user user %}" ) @@ -1608,6 +1613,7 @@ class GetAdminLogTests(TestCase): user.save() ct = ContentType.objects.get_for_model(User) LogEntry.objects.log_action(user.pk, ct.pk, user.pk, repr(user), 1) + context = Context({"log_entries": LogEntry.objects.all()}) t = Template( "{% load log %}" "{% get_admin_log 100 as admin_log %}" @@ -1615,7 +1621,7 @@ class GetAdminLogTests(TestCase): "{{ entry|safe }}" "{% endfor %}" ) - self.assertEqual(t.render(Context({})), "Added “<User: jondoe>”.") + self.assertEqual(t.render(context), "Added “<User: jondoe>”.") def test_missing_args(self): msg = "'get_admin_log' statements require two arguments" |