On 6/29/07, Michael Sylvan <[EMAIL PROTECTED]> wrote:
>
> Is there a way to do this sort of things cleanly, short of using the
> newforms-admin branch of Django? Or do I have to do something like
> changing the form's fields attribute by hand?

Using formsets from newforms-admin will be the easiest way to do this.
However, if you don't want to go down that path, you can use the
existing forms code without hand coding the id attributes.

When you create the form instance, you can specify a prefix that is
used for the name and id for each input on that form. e.g.,:

MyForm = form_for_model(Phone)

form1 = MyForm(prefix='phone1')
form2 = MyForm(prefix='phone2')
..

will generate two form instances; all the field names and id's for
form1 will be prefixed by 'phone1', and so on. This avoids the
inevitable name/id clash from having multiple instances of the same
form on a page.

This is true of _any_ form, whether created using form_for_model,
form_for_instance, manual definition, or anything else.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
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