diff --git a/tests/admin_inlines/models.py b/tests/admin_inlines/models.py
index cb1ec39ae5..d7c3b324a3 100644
a
|
b
|
Testing of admin inline formsets.
|
3 | 3 | """ |
4 | 4 | import random |
5 | 5 | |
| 6 | from django import forms |
6 | 7 | from django.contrib.contenttypes.fields import GenericForeignKey |
7 | 8 | from django.contrib.contenttypes.models import ContentType |
8 | 9 | from django.db import models |
… |
… |
class Inner2(models.Model):
|
88 | 89 | holder = models.ForeignKey(Holder2, models.CASCADE) |
89 | 90 | |
90 | 91 | |
| 92 | class CustomNumberInput(forms.NumberInput): |
| 93 | class Media: |
| 94 | js = ("custom_number.js",) |
| 95 | |
| 96 | |
| 97 | class CustomIntegerField(models.IntegerField): |
| 98 | def formfield(self, **kwargs): |
| 99 | kwargs["widget"] = CustomNumberInput |
| 100 | return super().formfield(**kwargs) |
| 101 | |
| 102 | |
91 | 103 | class Holder3(models.Model): |
92 | | dummy = models.IntegerField() |
| 104 | # The ordering of those two fields is important. |
| 105 | # https://code.djangoproject.com/ticket/30153 |
| 106 | dummy = CustomIntegerField() |
| 107 | date = models.DateField(blank=True, null=True) |
93 | 108 | |
94 | 109 | |
95 | 110 | class Inner3(models.Model): |
96 | | dummy = models.IntegerField() |
| 111 | dummy = CustomIntegerField() |
97 | 112 | holder = models.ForeignKey(Holder3, models.CASCADE) |
98 | 113 | |
99 | 114 | # Models for ticket #8190 |
diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py
index 749b3dd75f..a4c35da252 100644
a
|
b
|
class TestInlineMedia(TestDataMixin, TestCase):
|
490 | 490 | ) |
491 | 491 | self.assertContains(response, 'my_awesome_inline_scripts.js') |
492 | 492 | |
| 493 | self.assertEqual( |
| 494 | response.context["media"]._js, |
| 495 | [ |
| 496 | 'admin/js/vendor/jquery/jquery.min.js', |
| 497 | 'admin/js/jquery.init.js', |
| 498 | 'admin/js/core.js', |
| 499 | 'admin/js/admin/RelatedObjectLookups.js', |
| 500 | 'admin/js/actions.min.js', |
| 501 | 'admin/js/urlify.js', |
| 502 | 'admin/js/prepopulate.min.js', |
| 503 | 'admin/js/vendor/xregexp/xregexp.min.js', |
| 504 | 'admin/js/calendar.js', |
| 505 | 'admin/js/admin/DateTimeShortcuts.js', |
| 506 | 'admin/js/inlines.min.js', |
| 507 | 'my_awesome_inline_scripts.js', |
| 508 | 'custom_number.js', |
| 509 | ], |
| 510 | ) |
| 511 | |
493 | 512 | def test_all_inline_media(self): |
494 | 513 | holder = Holder2(dummy=13) |
495 | 514 | holder.save() |