From af35fb1fbb48e6125b313ad35238cd06fa3ce7b5 Mon Sep 17 00:00:00 2001 From: Brian Rosner Date: Fri, 1 Aug 2008 20:35:40 +0000 Subject: Ensure that custom primary keys are always shown on a formset. Refs #7938. Thanks magneto for discovering this problem. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8179 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/modeltests/model_formsets/models.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/modeltests/model_formsets/models.py b/tests/modeltests/model_formsets/models.py index b685d728d3..5b66d1560b 100644 --- a/tests/modeltests/model_formsets/models.py +++ b/tests/modeltests/model_formsets/models.py @@ -29,6 +29,10 @@ class AuthorMeeting(models.Model): def __unicode__(self): return self.name +class CustomPrimaryKey(models.Model): + my_pk = models.CharField(max_length=10, primary_key=True) + some_field = models.CharField(max_length=100) + __test__ = {'API_TESTS': """ @@ -330,5 +334,15 @@ Test using a custom prefix on an inline formset.

+# Test a custom primary key ################################################### + +We need to ensure that it is displayed + +>>> CustomPrimaryKeyFormSet = modelformset_factory(CustomPrimaryKey) +>>> formset = CustomPrimaryKeyFormSet() +>>> for form in formset.forms: +... print form.as_p() +

+

"""} -- cgit v1.3