summaryrefslogtreecommitdiff
path: root/django/forms/models.py
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2009-04-18 21:03:29 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2009-04-18 21:03:29 +0000
commitccc8e104eef01752f078bedc99ca6b756e1f048c (patch)
treec7189bcf35ea36e1b0aa65f3928eadb13b88afa3 /django/forms/models.py
parent1e4ad6f118007547c7e627f1d5bd11bfb2992bf9 (diff)
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
Diffstat (limited to 'django/forms/models.py')
-rw-r--r--django/forms/models.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index 95fc41e77f..d40a1ee55e 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -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: