mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
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.
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user