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

nested inlines with SortableTabularInline #257

Open
maxi-89 opened this issue Jul 8, 2022 · 0 comments
Open

nested inlines with SortableTabularInline #257

maxi-89 opened this issue Jul 8, 2022 · 0 comments

Comments

@maxi-89
Copy link

maxi-89 commented Jul 8, 2022

hi people, i had this code:

`

class ReportSectionFieldInline(nested_admin.NestedTabularInline):
    model = ReportSectionField
    extra = 0
    classes = ['collapse']


class ReportSectionInline(nested_admin.NestedTabularInline):
    model = ReportSection
    inlines = [ReportSectionFieldInline]
    extra = 0
    classes = ['secciones-informe']

    class Media:
        css = {
            "all": ("admin/css/reportsection.css",)
        }


class ReportAdmin(nested_admin.NestedModelAdmin):
    list_display = ('id', 'description', 'type_report', 'modulo', 'active',)
    search_fields = ('description', 'type_report',)
    list_filter = ('type_report', 'active',)

    inlines = [ReportSectionInline]

`

so, i want to drag and drop my ReportSectionFields . This is my new code:

`

class ReportSectionFieldInline(SortableTabularInline):
    model = ReportSectionField
    extra = 0
    classes = ['collapse']


class ReportSectionInline(SortableTabularInline):
    model = ReportSection
    inlines = [ReportSectionFieldInline]
    extra = 0
    classes = ['secciones-informe']

    class Media:
        css = {
            "all": ("admin/css/reportsection.css",)
        }


class ReportAdmin(NonSortableParentAdmin):
    list_display = ('id', 'description', 'type_report', 'modulo', 'active',)
    search_fields = ('description', 'type_report',)
    list_filter = ('type_report', 'active',)

    inlines = [ReportSectionInline]

`

but now, i cant see in django-admin-panel the ReportSectionFieldInline i just see ReportAdmin and ReportSectionInline. How can i order this fields when i m working when 2 levels of nested objects?

before:
image

after:
image

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

1 participant