Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jfunez opened this issue Mar 17, 2017 · 1 comment
Open

Comments

@jfunez
Copy link

jfunez commented Mar 17, 2017

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants