[ACCEPTED]-Django formset - how to update an object?-django-forms
Accepted answer
Rather than use modelformset_factory
, use inlineformset_factory
- see the documentation here - sorry, should 7 have pointed you to that initially.
Then 6 you can drop the queryset stuff, since inlineformset_factory 5 takes care of that, and just pass the instance
argument 4 (which here refers to the parent model, ie the Contact
object). You 3 also won't need to iterate through explicitly 2 setting the contact attribute on save, as 1 again that's taken care of.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.