Guard against rename_fields=None in submitted comprehension
The `submitted` list comprehension previously called `f in self.rename_fields` which raises TypeError when a subclass sets rename_fields=None. Short-circuit with `self.rename_fields and` to safely handle None, empty tuple, and populated tuples uniformly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9e909a9267
commit
a3b50b4198
|
|
@ -962,7 +962,7 @@ class BulkRenameView(GetReturnURLMixin, BaseMultiObjectView):
|
|||
if form.is_valid():
|
||||
submitted = [
|
||||
f for f in request.POST.getlist('field_names')
|
||||
if f in self.rename_fields
|
||||
if self.rename_fields and f in self.rename_fields
|
||||
]
|
||||
if self.rename_fields and not submitted:
|
||||
form.add_error(None, _("Select at least one field to rename."))
|
||||
|
|
|
|||
Loading…
Reference in New Issue