summaryrefslogtreecommitdiff
path: root/tests/modeltests/model_formsets
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 /tests/modeltests/model_formsets
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 'tests/modeltests/model_formsets')
-rw-r--r--tests/modeltests/model_formsets/models.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/modeltests/model_formsets/models.py b/tests/modeltests/model_formsets/models.py
index d8cbe34b94..f30b2125e2 100644
--- a/tests/modeltests/model_formsets/models.py
+++ b/tests/modeltests/model_formsets/models.py
@@ -108,6 +108,10 @@ class Price(models.Model):
class MexicanRestaurant(Restaurant):
serves_tacos = models.BooleanField()
+class ClassyMexicanRestaurant(MexicanRestaurant):
+ restaurant = models.OneToOneField(MexicanRestaurant, parent_link=True, primary_key=True)
+ tacos_are_yummy = models.BooleanField()
+
# models for testing unique_together validation when a fk is involved and
# using inlineformset_factory.
class Repository(models.Model):
@@ -934,4 +938,9 @@ True
>>> formset.get_queryset()
[<Player: Bobby>]
+# a formset for a Model that has a custom primary key that still needs to be
+# added to the formset automatically
+>>> FormSet = modelformset_factory(ClassyMexicanRestaurant, fields=["tacos_are_yummy"])
+>>> sorted(FormSet().forms[0].fields.keys())
+['restaurant', 'tacos_are_yummy']
"""}