From c9c9a5642512155e9693bf5fa6221fd26adeccca Mon Sep 17 00:00:00 2001 From: Eduardo Cereto Carvalho Date: Thu, 27 Sep 2012 15:55:27 +0200 Subject: [PATCH] Added complementary regression test for commit c1729510 Also fixed #18660. --- tests/regressiontests/admin_inlines/models.py | 3 +++ tests/regressiontests/admin_inlines/tests.py | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/tests/regressiontests/admin_inlines/models.py b/tests/regressiontests/admin_inlines/models.py index 5b703a7481..b004d5f85a 100644 --- a/tests/regressiontests/admin_inlines/models.py +++ b/tests/regressiontests/admin_inlines/models.py @@ -57,6 +57,9 @@ class Inner(models.Model): holder = models.ForeignKey(Holder) readonly = models.CharField("Inner readonly label", max_length=1) + def get_absolute_url(self): + return '/inner/' + class Holder2(models.Model): dummy = models.IntegerField() diff --git a/tests/regressiontests/admin_inlines/tests.py b/tests/regressiontests/admin_inlines/tests.py index 57f45ab0ff..5bb6077bff 100644 --- a/tests/regressiontests/admin_inlines/tests.py +++ b/tests/regressiontests/admin_inlines/tests.py @@ -148,6 +148,18 @@ class TestInline(TestCase): '', html=True) + @override_settings(USE_L10N=True, USE_THOUSAND_SEPARATOR=True) + def test_localize_pk_shortcut(self): + """ + Ensure that the "View on Site" link is correct for locales that use + thousand separators + """ + holder = Holder.objects.create(pk=123456789, dummy=42) + inner = Inner.objects.create(pk=987654321, holder=holder, dummy=42, readonly='') + response = self.client.get('/admin/admin_inlines/holder/%i/' % holder.id) + inner_shortcut = 'r/%s/%s/'%(ContentType.objects.get_for_model(inner).pk, inner.pk) + self.assertContains(response, inner_shortcut) + def test_custom_pk_shortcut(self): """ Ensure that the "View on Site" link is correct for models with a