mirror of
https://github.com/django/django.git
synced 2025-10-25 14:46:09 +00:00
Fixed #10799: fixed the use of list_editable with model inheritance and custom one-to-one parent links. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10590 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -470,7 +470,10 @@ class BaseModelFormSet(BaseFormSet):
|
||||
# data back. Generally, pk.editable should be false, but for some
|
||||
# reason, auto_created pk fields and AutoField's editable attribute is
|
||||
# True, so check for that as well.
|
||||
if (not pk.editable) or (pk.auto_created or isinstance(pk, AutoField)):
|
||||
def pk_is_editable(pk):
|
||||
return ((not pk.editable) or (pk.auto_created or isinstance(pk, AutoField))
|
||||
or (pk.rel and pk.rel.parent_link and pk_is_editable(pk.rel.to._meta.pk)))
|
||||
if pk_is_editable(pk):
|
||||
try:
|
||||
pk_value = self.get_queryset()[index].pk
|
||||
except IndexError:
|
||||
|
||||
Reference in New Issue
Block a user