﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
13762	Setting prefix on a ModelForm causes is_valid() to return False	Mark Tranchant	nobody	"Setting the prefix attribute on a ModelForm causes validation to fail. Here's a model and its associated form in the project I'm working on. Note that I've excluded the two foreign keys from the ModelForm, leaving just the text.

{{{
class RptTField(models.Model):
        report = models.ForeignKey(Rpt)
        config = models.ForeignKey(RptCfgTField)
        text = models.TextField()


class RptTForm(forms.ModelForm):
        class Meta:
                model = RptTField
                exclude = ('report','config')


>>> from myproj.models import *
>>> a = RptTForm({'text':'hello world'})
>>> a.prefix
>>> a.is_valid()
True
>>> b = RptTForm({'text':'hello world'},prefix='abc')
>>> b.prefix
'abc'
>>> b.is_valid()
False
}}}

I can't see anything in the docs that explains this behaviour. I need this as I'm bundling multiple ModelForms into one HTML form, and need to put the prefix in when binding to the POST data in case validation fails and the form needs re-drawing. This is with the latest SVN, 13353."		closed	Uncategorized	dev		duplicate			Unreviewed	0	0	0	0	0	0
