AndrewIngram/django-extra-views

Multiple CreateWithInlinesView in one view?

DarnelleF opened this issue · 3 comments

I was just wondering if i can find a way to have multiple CreateWithInlinesView in one view?

or

Can i put a CreateWithInlinesView as an inline so i can have a chain of CreateWithInlinesView with their own inlines
for example

class ThingInline(Inlinesetfactory):
model = thing

class ItemView(CreateWithInlinesView)
inlines = [ThingInline]

class OrderView(CreateWithInlinesView):
inlines = [ItemView]

I need a template with multiple CreateWithInlinesView forms but i can't seem to get this to work all in one view.

Hi @DarnelleF,

Each CreateWithInlinesView subclass is intended to serve exactly one view. That view can have multiple InlineFormsetFactory subclasses within its inlines = [...] attribute, but all of those inlines should be related to the single parent object associated with the CreateWithInlinesView subclass.

Chaining inlines in multiple layers as you have tried to do is not supported in this library. You'll need to write your own custom view to do that.

Hope that helps.

Glad you got it sorted. You're welcome.