diff options
| author | django-bot <ops@djangoproject.com> | 2025-07-22 20:41:41 -0700 |
|---|---|---|
| committer | nessita <124304+nessita@users.noreply.github.com> | 2025-07-23 20:17:55 -0300 |
| commit | 69a93a88edb56ba47f624dac7a21aacc47ea474f (patch) | |
| tree | f57507a4435d032493cae40e06ecb254790b67b2 /django/contrib/admin | |
| parent | 55b0cc21310b76ce4018dd793ba50556eaf0af06 (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 'django/contrib/admin')
| -rw-r--r-- | django/contrib/admin/actions.py | 3 | ||||
| -rw-r--r-- | django/contrib/admin/checks.py | 3 | ||||
| -rw-r--r-- | django/contrib/admin/options.py | 12 | ||||
| -rw-r--r-- | django/contrib/admin/sites.py | 16 | ||||
| -rw-r--r-- | django/contrib/admin/templatetags/admin_list.py | 9 | ||||
| -rw-r--r-- | django/contrib/admin/tests.py | 6 | ||||
| -rw-r--r-- | django/contrib/admin/utils.py | 10 | ||||
| -rw-r--r-- | django/contrib/admin/views/main.py | 7 | ||||
| -rw-r--r-- | django/contrib/admin/widgets.py | 7 |
9 files changed, 40 insertions, 33 deletions
diff --git a/django/contrib/admin/actions.py b/django/contrib/admin/actions.py index 865c16aff2..04a906542a 100644 --- a/django/contrib/admin/actions.py +++ b/django/contrib/admin/actions.py @@ -24,7 +24,8 @@ def delete_selected(modeladmin, request, queryset): deletable objects, or, if the user has no permission one of the related childs (foreignkeys), a "permission denied" message. - Next, it deletes all selected objects and redirects back to the change list. + Next, it deletes all selected objects and redirects back to the change + list. """ opts = modeladmin.model._meta app_label = opts.app_label diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py index 775bb12145..10257a54bf 100644 --- a/django/contrib/admin/checks.py +++ b/django/contrib/admin/checks.py @@ -316,7 +316,8 @@ class BaseModelAdminChecks: def _check_fields(self, obj): """Check that `fields` only refer to existing fields, doesn't contain - duplicates. Check if at most one of `fields` and `fieldsets` is defined. + duplicates. Check if at most one of `fields` and `fieldsets` is + defined. """ if obj.fields is None: diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index c3ccc6c4fe..6c202c8e61 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -170,10 +170,10 @@ class BaseModelAdmin(metaclass=forms.MediaDefiningClass): # ForeignKey or ManyToManyFields if isinstance(db_field, (models.ForeignKey, models.ManyToManyField)): - # Combine the field kwargs with any options for formfield_overrides. - # Make sure the passed in **kwargs override anything in - # formfield_overrides because **kwargs is more specific, and should - # always win. + # Combine the field kwargs with any options for + # formfield_overrides. Make sure the passed in **kwargs override + # anything in formfield_overrides because **kwargs is more + # specific, and should always win. if db_field.__class__ in self.formfield_overrides: kwargs = {**self.formfield_overrides[db_field.__class__], **kwargs} @@ -2182,8 +2182,8 @@ class ModelAdmin(BaseModelAdmin): if obj is None: return self._get_obj_does_not_exist_redirect(request, self.opts, object_id) - # Populate deleted_objects, a data structure of all related objects that - # will also be deleted. + # Populate deleted_objects, a data structure of all related objects + # that will also be deleted. ( deleted_objects, model_count, diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index 9c9aa21f57..17af19fd1b 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -29,11 +29,11 @@ all_sites = WeakSet() class AdminSite: """ - An AdminSite object encapsulates an instance of the Django admin application, ready - to be hooked in to your URLconf. Models are registered with the AdminSite using the - register() method, and the get_urls() method can then be used to access Django view - functions that present a full admin interface for the collection of registered - models. + An AdminSite object encapsulates an instance of the Django admin + application, ready to be hooked in to your URLconf. Models are registered + with the AdminSite using the register() method, and the get_urls() method + can then be used to access Django view functions that present a full admin + interface for the collection of registered models. """ # Text to put at the end of each page's <title>. @@ -136,9 +136,9 @@ class AdminSite: # If we got **options then dynamically construct a subclass of # admin_class with those **options. if options: - # For reasons I don't quite understand, without a __module__ - # the created class appears to "live" in the wrong place, - # which causes issues later on. + # For reasons I don't quite understand, without a + # __module__ the created class appears to "live" in the + # wrong place, which causes issues later on. options["__module__"] = __name__ admin_class = type( "%sAdmin" % model.__name__, (admin_class,), options diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index 1e6f8bf298..43d87c0024 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -256,7 +256,8 @@ def items_for_result(cl, result, form): ): row_classes.append("nowrap") row_class = mark_safe(' class="%s"' % " ".join(row_classes)) - # If list_display_links not defined, add the link tag to the first field + # If list_display_links not defined, add the link tag to the first + # field if link_to_changelist: table_tag = "th" if first else "td" first = False @@ -293,9 +294,9 @@ def items_for_result(cl, result, form): "<{}{}>{}</{}>", table_tag, row_class, link_or_text, table_tag ) else: - # By default the fields come from ModelAdmin.list_editable, but if we pull - # the fields out of the form instead of list_editable custom admins - # can provide fields on a per request basis + # By default the fields come from ModelAdmin.list_editable, but if + # we pull the fields out of the form instead of list_editable + # custom admins can provide fields on a per request basis if ( form and field_name in form.fields diff --git a/django/contrib/admin/tests.py b/django/contrib/admin/tests.py index b95a37b959..bd9c76b5fd 100644 --- a/django/contrib/admin/tests.py +++ b/django/contrib/admin/tests.py @@ -218,9 +218,9 @@ class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase): actual_values.append(option.get_attribute("value")) self.assertEqual(values, actual_values) else: - # Prevent the `find_elements(By.CSS_SELECTOR, …)` call from blocking - # if the selector doesn't match any options as we expect it - # to be the case. + # Prevent the `find_elements(By.CSS_SELECTOR, …)` call from + # blocking if the selector doesn't match any options as we expect + # it to be the case. with self.disable_implicit_wait(): self.wait_until( lambda driver: not driver.find_elements( diff --git a/django/contrib/admin/utils.py b/django/contrib/admin/utils.py index eec93fa4be..74bd571e56 100644 --- a/django/contrib/admin/utils.py +++ b/django/contrib/admin/utils.py @@ -73,7 +73,8 @@ def prepare_lookup_value(key, value, separator=","): # if key ends with __in, split parameter into separate values if key.endswith("__in"): value = value.split(separator) - # if key ends with __isnull, special case '' and the string literals 'false' and '0' + # if key ends with __isnull, special case '' and the string literals + # 'false' and '0' elif key.endswith("__isnull"): value = value.lower() not in ("", "false", "0") return value @@ -558,9 +559,10 @@ def construct_change_message(form, formsets, add): Translations are deactivated so that strings are stored untranslated. Translation happens later on LogEntry access. """ - # Evaluating `form.changed_data` prior to disabling translations is required - # to avoid fields affected by localization from being included incorrectly, - # e.g. where date formats differ such as MM/DD/YYYY vs DD/MM/YYYY. + # Evaluating `form.changed_data` prior to disabling translations is + # required to avoid fields affected by localization from being included + # incorrectly, e.g. where date formats differ such as MM/DD/YYYY vs + # DD/MM/YYYY. changed_data = form.changed_data with translation_override(None): # Deactivate translations while fetching verbose_name for form diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index ed6c6f9219..8c9118808e 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -322,7 +322,8 @@ class ChangeList: self.result_count = result_count self.show_full_result_count = self.model_admin.show_full_result_count # Admin actions are shown if there is at least one entry - # or if entries are not counted because show_full_result_count is disabled + # or if entries are not counted because show_full_result_count is + # disabled self.show_admin_actions = not self.show_full_result_count or bool( full_result_count ) @@ -485,8 +486,8 @@ class ChangeList: """ Return a dictionary of ordering field column numbers and asc/desc. """ - # We must cope with more than one column having the same underlying sort - # field, so we base things on column numbers. + # We must cope with more than one column having the same underlying + # sort field, so we base things on column numbers. ordering = self._get_default_ordering() ordering_fields = {} if ORDER_VAR not in self.params: diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py index fc83267e43..a601fc2667 100644 --- a/django/contrib/admin/widgets.py +++ b/django/contrib/admin/widgets.py @@ -215,8 +215,8 @@ class ForeignKeyRawIdWidget(forms.TextInput): class ManyToManyRawIdWidget(ForeignKeyRawIdWidget): """ - A Widget for displaying ManyToMany ids in the "raw_id" interface rather than - in a <select multiple> box. + A Widget for displaying ManyToMany ids in the "raw_id" interface rather + than in a <select multiple> box. """ template_name = "admin/widgets/many_to_many_raw_id.html" @@ -275,7 +275,8 @@ class RelatedFieldWidgetWrapper(forms.Widget): if not isinstance(widget, AutocompleteMixin): self.attrs["data-context"] = "available-source" self.can_change_related = not multiple and can_change_related - # XXX: The deletion UX can be confusing when dealing with cascading deletion. + # XXX: The deletion UX can be confusing when dealing with cascading + # deletion. cascade = getattr(rel, "on_delete", None) is CASCADE self.can_delete_related = not multiple and not cascade and can_delete_related self.can_view_related = not multiple and can_view_related |
