AndrewIngram / django-extra-views

Django's class-based generic views are awesome, let's have more of them.
MIT License
1.39k stars 172 forks source link

Multiple CreateWithInlinesView in one view? #224

Closed DarnelleF closed 3 years ago

DarnelleF commented 3 years ago

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.

sdolemelipone commented 3 years ago

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.

DarnelleF commented 3 years ago

Thanks for your help i do apologize for not properly tagging this as a question but i wrote my own view instead. thanks for the assistance!!

On Mon, Jan 18, 2021 at 9:10 AM Mark G notifications@github.com wrote:

Hi @DarnelleF https://github.com/DarnelleF,

Each CreateWithInlinesView subclass is intended to serve exactly as 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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AndrewIngram/django-extra-views/issues/224#issuecomment-762240801, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVTVVKUAOQ547EZS5UWJZTS2QXLLANCNFSM4WGGCS2A .

sdolemelipone commented 3 years ago

Glad you got it sorted. You're welcome.