diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-04-18 21:03:29 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-04-18 21:03:29 +0000 |
| commit | ccc8e104eef01752f078bedc99ca6b756e1f048c (patch) | |
| tree | c7189bcf35ea36e1b0aa65f3928eadb13b88afa3 /tests/modeltests/model_formsets | |
| parent | 1e4ad6f118007547c7e627f1d5bd11bfb2992bf9 (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.py | 9 |
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'] """} |
