Answer the question
In order to leave comments, you need to log in
Why is the parent form inline formset not displayed?
class ExchangeRate(StampedModel):
document = models.ForeignKey(DocExchangeRate)
# another fields
ExchangeInlineFormset = inlineformset_factory(DocExchangeRate, ExchangeRate, fk_name='document', extra=1)
class DocExchangeRateCreateView(CreateView):
model = DocExchangeRate
def get(self, request, *args, **kwargs):
from django.shortcuts import render
self.object = None
formset = ExchangeInlineFormset()
return render(request, 'pricing/docexchangerate_form.html', self.get_context_data(formset=formset))
<form action="" method="post">{% csrf_token %}
{{ form }}
{{ formset.management_form }}
{{ formset }}
<input type="submit" class="submit"/>
</form>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question