asifpy / django-crudbuilder

Generic CRUD implementation in Django
https://django-crudbuilder.readthedocs.org/en/latest/index.html
Apache License 2.0
193 stars 67 forks source link

allow to define more than one inline crud - more like the djando admin #41

Open jfunez opened 7 years ago

jfunez commented 7 years ago

Right now is possible to define one inline crud: as docs explains:

# yourapp/crud.py
from crudbuilder.formset import BaseInlineFormset

class PersonEmploymentInlineFormset(BaseInlineFormset):
        inline_model = PersonEmployment
        parent_model = Person
        exclude = ['created_by', 'updated_by']
        #formset_class = YourBaseInlineFormset
        #child_form = ChildModelForm

class PersonCrud(BaseCrudBuilder):
        model = Person
        search_fields = ['name']
        tables2_fields = ('name', 'email')
        inlineformset = PersonEmploymentInlineFormset

What I want:

# yourapp/crud.py
from crudbuilder.formset import BaseInlineFormset

class PersonFooInlineFormset(BaseInlineFormset):
        inline_model = PersonFoo
        parent_model = Person
        exclude = ['created_by', 'updated_by']

class PersonEmploymentInlineFormset(BaseInlineFormset):
        inline_model = PersonEmployment
        parent_model = Person
        exclude = ['created_by', 'updated_by']

class PersonCrud(BaseCrudBuilder):
        model = Person
        search_fields = ['name']
        tables2_fields = ('name', 'email')
        inlineformset = [
                PersonEmploymentInlineFormset,
                PersonFooInlineFormset
        ]

inlineformset's items order should be respected when rendered

Thanks for you great app!

marcoshemann commented 6 years ago

This is a great feature, Asifpy may you think about it?