I am trying to add an inline set of forms to a form. Here is the minimum code to reproduce the error:
models.py
class Festival(Model): desc = TextField(max_length=1000) class FestivalAddress(Model): festival = ForeignKey(Festival, related_name="addresses") name = CharField(max_length="50")
urls.py
urlpatterns = patterns('', url('^add/$', FestivalCreateView.as_view(), name='festival_add'), )
views.py
class FestivalCreateView(CreateView): model = Festival form_class = FestivalForm
forms.py
class FestivalAddressForm(ModelForm): class Meta: model = FestivalAddress class FestivalForm(ModelForm): class Meta: model = Festival FestivalAddressFormSet = inlineformset_factory(FestivalForm, FestivalAddress, form=FestivalAddressForm, extra=2)
This raises AttributeError: the ModelFormOptions object does not have the attribute 'get_parent_list'. I'm a bit of a dead end since I am executing the solution given here in SO format .
Change I removed the use of the form set in FestivalCreateView because an error occurs with or without it.
django django-forms inline-formset
knite Jun 25 2018-12-12T00: 00Z
source share