Hello,

I am trying to use newforms and templates, together with the following
models, to mimic what the admin application does with num_in_admin :
provide a form for Person's fields, and multiple Phone forms.

With just one Phone form things are quite straightforward: validate
the Person form, and if that passes, save the object, get its ID, fill
the ID field of the Phone object and then save it.

With multiple Phone forms, however, I have not been able to customize
the HTML IDs of the various fields -- form_for_model generates
identical forms!

One can modify form_for_model with a custom formfield_callback
function, but as far as I can tell, it maps a field name to a field
object, so it won't be enough to override that.

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?

Thanks,

-- M. Sylvan

class Person(models.Model):
    firstName = models.CharField(maxlength=32)
    lastName  = models.CharField(maxlength=32)

class Phone(models.Model):
    person = models.ForeignKey(Person)
    number = models.CharField(maxlength=24, core=True)


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