django-crudbuilder icon indicating copy to clipboard operation
django-crudbuilder copied to clipboard

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

Open jfunez opened this issue 8 years ago • 1 comments

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!

jfunez avatar Mar 17 '17 14:03 jfunez

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

marcoshemann avatar Mar 01 '18 00:03 marcoshemann