mirror of
https://github.com/django/django.git
synced 2025-11-19 03:08:59 +00:00
Fixed #28930 -- Simplified code with any() and all().
This commit is contained in:
parent
c21f158295
commit
4c599ece57
18 changed files with 54 additions and 115 deletions
|
|
@ -336,10 +336,10 @@ class InlineAdminForm(AdminForm):
|
|||
return True
|
||||
# Also search any parents for an auto field. (The pk info is propagated to child
|
||||
# models so that does not need to be checked in parents.)
|
||||
for parent in self.form._meta.model._meta.get_parent_list():
|
||||
if parent._meta.auto_field or not parent._meta.model._meta.pk.editable:
|
||||
return True
|
||||
return False
|
||||
return any(
|
||||
parent._meta.auto_field or not parent._meta.model._meta.pk.editable
|
||||
for parent in self.form._meta.model._meta.get_parent_list()
|
||||
)
|
||||
|
||||
def pk_field(self):
|
||||
return AdminField(self.form, self.formset._pk_field.name, False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue