summaryrefslogtreecommitdiff
path: root/tests/modeladmin/tests.py
diff options
context:
space:
mode:
authordjango-bot <ops@djangoproject.com>2025-07-22 20:41:41 -0700
committernessita <124304+nessita@users.noreply.github.com>2025-07-23 20:17:55 -0300
commit69a93a88edb56ba47f624dac7a21aacc47ea474f (patch)
treef57507a4435d032493cae40e06ecb254790b67b2 /tests/modeladmin/tests.py
parent55b0cc21310b76ce4018dd793ba50556eaf0af06 (diff)
Refs #36500 -- Rewrapped long docstrings and block comments via a script.
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
Diffstat (limited to 'tests/modeladmin/tests.py')
-rw-r--r--tests/modeladmin/tests.py35
1 files changed, 20 insertions, 15 deletions
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py
index ecead78154..4a92514e17 100644
--- a/tests/modeladmin/tests.py
+++ b/tests/modeladmin/tests.py
@@ -73,12 +73,13 @@ class ModelAdminTests(TestCase):
self.assertIsNone(ma.get_exclude(request, self.band))
def test_default_fieldsets(self):
- # fieldsets_add and fieldsets_change should return a special data structure that
- # is used in the templates. They should generate the "right thing" whether we
- # have specified a custom form, the fields argument, or nothing at all.
+ # fieldsets_add and fieldsets_change should return a special data
+ # structure that is used in the templates. They should generate the
+ # "right thing" whether we have specified a custom form, the fields
+ # argument, or nothing at all.
#
- # Here's the default case. There are no custom form_add/form_change methods,
- # no fields argument, and no fieldsets argument.
+ # Here's the default case. There are no custom form_add/form_change
+ # methods, no fields argument, and no fieldsets argument.
ma = ModelAdmin(Band, self.site)
self.assertEqual(
ma.get_fieldsets(request),
@@ -294,7 +295,8 @@ class ModelAdminTests(TestCase):
# Form class to the fields specified. This may cause errors to be
# raised in the db layer if required model fields aren't in fields/
# fieldsets, but that's preferable to ghost errors where a field in the
- # Form class isn't being displayed because it's not in fields/fieldsets.
+ # Form class isn't being displayed because it's not in
+ # fields/fieldsets.
# Using `fields`.
class BandAdmin(ModelAdmin):
@@ -403,7 +405,8 @@ class ModelAdminTests(TestCase):
def test_custom_form_meta_exclude(self):
"""
The custom ModelForm's `Meta.exclude` is overridden if
- `ModelAdmin.exclude` or `InlineModelAdmin.exclude` are defined (#14496).
+ `ModelAdmin.exclude` or `InlineModelAdmin.exclude` are defined
+ (#14496).
"""
# With ModelAdmin
@@ -702,9 +705,10 @@ class ModelAdminTests(TestCase):
def test_default_foreign_key_widget(self):
# First, without any radio_fields specified, the widgets for ForeignKey
# and fields with choices specified ought to be a basic Select widget.
- # ForeignKey widgets in the admin are wrapped with RelatedFieldWidgetWrapper so
- # they need to be handled properly when type checking. For Select fields, all of
- # the choices lists have a first entry of dashes.
+ # ForeignKey widgets in the admin are wrapped with
+ # RelatedFieldWidgetWrapper so they need to be handled properly when
+ # type checking. For Select fields, all of the choices lists have a
+ # first entry of dashes.
cma = ModelAdmin(Concert, self.site)
cmafa = cma.get_form(request)
@@ -732,9 +736,10 @@ class ModelAdminTests(TestCase):
def test_foreign_key_as_radio_field(self):
# Now specify all the fields as radio_fields. Widgets should now be
- # RadioSelect, and the choices list should have a first entry of 'None' if
- # blank=True for the model field. Finally, the widget should have the
- # 'radiolist' attr, and 'inline' as well if the field is specified HORIZONTAL.
+ # RadioSelect, and the choices list should have a first entry of 'None'
+ # if blank=True for the model field. Finally, the widget should have
+ # the 'radiolist' attr, and 'inline' as well if the field is specified
+ # HORIZONTAL.
class ConcertAdmin(ModelAdmin):
radio_fields = {
"main_band": HORIZONTAL,
@@ -937,8 +942,8 @@ class ModelAdminTests(TestCase):
def test_get_deleted_objects_with_custom_has_delete_permission(self):
"""
- ModelAdmin.get_deleted_objects() uses ModelAdmin.has_delete_permission()
- for permissions checking.
+ ModelAdmin.get_deleted_objects() uses
+ ModelAdmin.has_delete_permission() for permissions checking.
"""
mock_request = MockRequest()
mock_request.user = User.objects.create_superuser(