Skip to content
Advertisement

Tag: formset

Django: populating many to many field using modelformset_factory

I try to populate a many-to-many field. The Relationship exists between the Menus and Course Model. I added some custom fields to the M2M Table, so I can store the order of the courses and their type (i.e. Starter, Appetizer, etc.). To get a dynamic webform, I use modelformset_factory with the python-formset-js-improved pip package (https://pypi.org/project/django-formset-js-improved/). following the logic in my

Formset Not Saving on UpdateView Django

I’m having problem on formset not saving on UpdateView. This has been discussed in several SO post, and so far I can summarized them to following Make sure to pass an instance. Hence. Reference context[‘formset’] = journal_entry_formset(self.request.POST, instance=self.object) Override the POST method. Reference Another One My UpdateView is an exact replica of my CreateView except for two changes above. Here

Advertisement