mirror of
https://github.com/django/django.git
synced 2025-10-25 14:46:09 +00:00
Fixed #10893 -- Corrected a problem with using list_editable in the admin when the model has a manual primary key. Thanks to Alex Gaynor for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10681 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -560,10 +560,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.
|
||||
def pk_is_editable(pk):
|
||||
def pk_is_not_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):
|
||||
or (pk.rel and pk.rel.parent_link and pk_is_not_editable(pk.rel.to._meta.pk)))
|
||||
if pk_is_not_editable(pk) or pk.name not in form.fields:
|
||||
try:
|
||||
pk_value = self.get_queryset()[index].pk
|
||||
except IndexError:
|
||||
|
||||
Reference in New Issue
Block a user