Tuesday, October 26, 2010

Re: Displaying Profile model in a form



On Wed, Oct 27, 2010 at 4:13 AM, christian.posta <christian.posta@gmail.com> wrote:
I'm trying to display a form that has both the UserProfile fields and
a select handful of the User fields.
What's the best way to go about doing this? In the CreateUserForm that
I'm creating, I have an inner Meta class with the 'model' = User, but
of course that won't display the UserProfile fields. If I switch it to
UserProfile, it won't display the User fields. I could re-create each
of the UserProfile fields in the form, but that wouldn't be very DRY.
On top of that, I'd have to handle the cascading commit and
transactions myself if I manually handled the UserProfile and User
objects separately. I'm hoping the framework has something and I just
missed it?

Try having a look : from django.forms.models import inlineformset_factory
Or http://collingrady.wordpress.com/2008/02/18/editing-multiple-objects-in-django-with-newforms/

Hope that helps.

-V
http://twitter.com/venkasub

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment