Hi Joseph,

I say thanks for the pointer, too.
A quick question (since you seem to be involved with this), is there any
reason to have django not prefix the form fields by default with, say,
the model-name (so prefix='' or prefix='somethingelse' can still be
used if someone doesn't want it that way).

I would definately vote for making it default unless someone can come
up with potential problems it may cause. There'd be just one thing less
to worry about if it was that way...

And if there are worries about backwards compatibility I'd propose a
toggle-option in settings.py defaulting to False.


-mark

On Wed, 2007-09-26 at 01:29 -0500, Joseph Kocherhans wrote:
> On 9/26/07, Przemek Gawronski <[EMAIL PROTECTED]> wrote:
> >
> > I'm using several forms (newforms) to build one html form. One thing to
> > watch out for is common field names in your django form classes. So if
> > you have two django forms and they both have a field 'date' for example,
> > then handling in your view method in request.POST there will be only one
> > key 'date' that will go in to both django forms via
> > f1=Form1(request.POST) and f2=Form2(request.POST). I'm still thinking on
> > how to solve this in a elegant way instead of changing the field names
> > in django forms to say date1 and date2.
> 
> Try this:
> 
>    f1 = Form1(request.POST, prefix='form1')
>    f2 = Form2(request.POST, prefix='form2')
> 
> That should solve your problem. The prefix argument is prepended to
> every field name in the html, thus preventing name clashes between
> forms. That should be in the 0.96 release. No docs on it yet though.
> Sorry :(
> 
> Here's the changeset that added it, and the tests there should show
> you some examples if needed
> http://code.djangoproject.com/changeset/4194
> 
> Joseph



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to