formset

Create multiple objects in one form Django

Create multiple objects in one form Django Question: I am trying to create a form in Django that can create one Student object with two Contact objects in the same form. The second Contact object must be optional to fill in (not required). Schematic view of the objects created in the single form: Contact 1 …

Total answers: 2

Django, extract value from formset

Django, extract value from formset Question: I have overridden save_formset method to extract data from admin page. Here is how my code looks like: def save_formset(self, request, form, formset, change): for f in formset: print(‘Voter address is: ‘, f[‘voter_address’]) super().save_formset(request,form, formset, change) I get output as: But I want to extract actual value which is …

Total answers: 2

How to add custom fields to InlineFormsets?

How to add custom fields to InlineFormsets? Question: I’m trying to add custom fields to an InlineFormset using the following code, but the fields won’t show up in the Django Admin. Is the InlineFormset too locked down to allow this? My print “ding” test fires as expected, I can print out the form.fields and see …

Total answers: 3