diff options
| author | antoliny0919 <antoliny0919@gmail.com> | 2024-12-25 11:35:27 +0900 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-01-10 12:57:53 +0100 |
| commit | 97ee8b82c2c99bf352df5359bb24a42ea78585b8 (patch) | |
| tree | cf714ede8d5d8ec504b276bdf7c88114a5324c0f /tests/admin_utils | |
| parent | 585160586336f3bcd7b694f53cf10db73c56981c (diff) | |
Fixed #36032 -- Rendered URLField values as links in the admin.
Diffstat (limited to 'tests/admin_utils')
| -rw-r--r-- | tests/admin_utils/tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/admin_utils/tests.py b/tests/admin_utils/tests.py index 56d46324e0..77d6655290 100644 --- a/tests/admin_utils/tests.py +++ b/tests/admin_utils/tests.py @@ -157,6 +157,7 @@ class UtilsTests(SimpleTestCase): models.DateField(), models.DecimalField(), models.FloatField(), + models.URLField(), models.JSONField(), models.TimeField(), ] @@ -196,6 +197,14 @@ class UtilsTests(SimpleTestCase): display_value, ) + def test_url_display_for_field(self): + model_field = models.URLField() + display_value = display_for_field( + "http://example.com", model_field, self.empty_value + ) + expected = '<a href="http://example.com">http://example.com</a>' + self.assertHTMLEqual(display_value, expected) + def test_number_formats_display_for_field(self): display_value = display_for_field( 12345.6789, models.FloatField(), self.empty_value |
