summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2019-08-29 16:29:55 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-09-16 11:37:09 +0200
commitb9db423d3c525697ad59b14c0dcaaccf2770d062 (patch)
tree40037f0f3fea752cca683fe988e158bbb106f1b4 /tests
parent44077985f58be02214a11ffde35776fed3c960e1 (diff)
Fixed #29376 -- Allowed hiding "Save and Add Another" button in admin.
Diffstat (limited to 'tests')
-rw-r--r--tests/admin_views/test_templatetags.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/admin_views/test_templatetags.py b/tests/admin_views/test_templatetags.py
index 71953d08ca..f717b8e1b7 100644
--- a/tests/admin_views/test_templatetags.py
+++ b/tests/admin_views/test_templatetags.py
@@ -29,6 +29,25 @@ class AdminTemplateTagsTest(AdminViewBasicTestCase):
self.assertIs(template_context['extra'], True)
self.assertIs(template_context['show_save'], True)
+ def test_override_show_save_and_add_another(self):
+ request = self.request_factory.get(
+ reverse('admin:auth_user_change', args=[self.superuser.pk]),
+ )
+ request.user = self.superuser
+ admin = UserAdmin(User, site)
+ for extra_context, expected_flag in (
+ ({}, True), # Default.
+ ({'show_save_and_add_another': False}, False),
+ ):
+ with self.subTest(show_save_and_add_another=expected_flag):
+ response = admin.change_view(
+ request,
+ str(self.superuser.pk),
+ extra_context=extra_context,
+ )
+ template_context = submit_row(response.context_data)
+ self.assertIs(template_context['show_save_and_add_another'], expected_flag)
+
def test_override_change_form_template_tags(self):
"""
admin_modify template tags follow the standard search pattern