Inlineformset may solve your problem, and this http://haineault.com/blog/155/ is a good example.
在 2013年9月26日星期四UTC+8下午1时19分41秒,Adam写道:
-- 在 2013年9月26日星期四UTC+8下午1时19分41秒,Adam写道:
Hi,
I am trying to handle 2 ModelForm in 1 view. Is that possible with CBV solution? Does any best practise exist?
Here is the problem in details.
## models.py
class UserProfile(HasJPAddresses, models.Model):
user = models.OneToOneField(User)
birthdate = models.DateField(default='1900-01-01')
## forms.py
class UserProfileUpdateForm(forms.ModelForm):
class Meta:
model = UserProfile
class UserUpdateForm(forms.ModelForm):
class Meta:
model = User
fields = ['first_name', 'last_name']
## views.py
class UserProfileUpdateView(FormView): <<<<<<<---- How could I handle two forms at once in a view?
Thanks,
/Adam
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment