mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Added complementary regression test for commit c1729510
Also fixed #18660.
This commit is contained in:
parent
50d573d2c0
commit
c9c9a56425
@ -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()
|
||||
|
@ -148,6 +148,18 @@ class TestInline(TestCase):
|
||||
'<input id="id_-2-0-name" type="text" class="vTextField" '
|
||||
'name="-2-0-name" maxlength="100" />', 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
|
||||
|
Loading…
Reference in New Issue
Block a user