summaryrefslogtreecommitdiff
path: root/django/forms/models.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-05-07 11:56:10 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-05-07 11:56:10 +0000
commiteb81d5acb3e1fee57153c0a4719e3f26ae66c5cd (patch)
tree94d6b38d3fa5e8860f983aa8e5341e1af61c1155 /django/forms/models.py
parent95477d7a80a7b20647a37e652d7f41b4d59b4b80 (diff)
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
Diffstat (limited to 'django/forms/models.py')
-rw-r--r--django/forms/models.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index 86eeceedd3..910253c188 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -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: