From 709476ae0574ee19d35640c03770377cfca6d91d Mon Sep 17 00:00:00 2001 From: Karen Tracey Date: Mon, 19 Jan 2009 19:43:01 +0000 Subject: [1.0.X] Fixed #10069 -- Fixed the model form unique validation code to not proceed with using, for example, RelatedObjects returned by get_field_by_name as though they were model Fields. r9777 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9778 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/modeltests/model_forms/models.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') diff --git a/tests/modeltests/model_forms/models.py b/tests/modeltests/model_forms/models.py index 0489ea81d8..46d26c5cdc 100644 --- a/tests/modeltests/model_forms/models.py +++ b/tests/modeltests/model_forms/models.py @@ -193,6 +193,17 @@ Extra fields. >>> CategoryForm.base_fields.keys() ['name', 'slug', 'url', 'some_extra_field'] +Extra field that has a name collision with a related object accessor. + +>>> class WriterForm(ModelForm): +... book = forms.CharField(required=False) +... +... class Meta: +... model = Writer + +>>> wf = WriterForm({'name': 'Richard Lockridge'}) +>>> wf.is_valid() +True Replacing a field. -- cgit v1.3