Skip to content Skip to sidebar Skip to footer

Inline Formset Factory Update View

i want to get in inline formset factory in update view extra=0, if it have more than 1 contact. So this is my code forms.py class ShopForm(ModelForm): class Meta: mode

Solution 1:

The answer is was simple, i should use max_num=1 in

 ShopInlineFormSet = inlineformset_factory(Shop, Contacts, extra=1,max_num=1,
                                  fields=(
                                      'published', 'phone', 'address', 'place', 'latitude',
                                      'longitude', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday',
                                      'saturday', 'sunday'), can_delete=True)

Post a Comment for "Inline Formset Factory Update View"