[Django]-Django admin StackedInline in custom tab

0๐Ÿ‘

โœ…

I found that django-baton template does support custom form tab and i managed to get 3 inlines in a single tab

https://django-baton.readthedocs.io/en/latest/form_tabs.html

inlines = [
    UserKycInline, UserWalletInline, UserBankInline, CardBindingInline, TopUpsInline, TransfersInline, WithdrawalsInline,
]

fieldsets = (
    ('General', {
        'fields': ('id', 'uid', 'phone_number', 'nickname', 'status', 'eth_address', 'evt_address', 'created', 'modified',),
        'classes': ('baton-tabs-init', 'baton-tab-group-fs-kyc--inline-userkyc', 'baton-tab-group-fs-wallets--inline-user_wallet', 'baton-tab-group-fs-banks--inline-user_bank', 'baton-tab-group-fs-cards--inline-user_binding', 'baton-tab-group-fs-transactions--inline-user_toptup--inline-transfers--inline-user_transfer--inline-user_withdrawal', ),
    }),
    ('KYC', {
        'fields': (),
        'classes': ('tab-fs-kyc', ),
    }),
    ('WALLETS', {
        'fields': (),
        'classes': ('tab-fs-wallets', ),
    }),
    ('BANKS', {
        'fields': (),
        'classes': ('tab-fs-banks', ),
    }),
    ('CARDS', {
        'fields': (),
        'classes': ('tab-fs-cards', ),
    }),
    ('Transactions', {
        'fields': (),
        'classes': ('tab-fs-transactions', ),
    }),
)
๐Ÿ‘คLinh Nguyen

0๐Ÿ‘

It is not possible with the standard django admin, I suggest you to try django-tabbed-admin.

๐Ÿ‘คFabio Caccamo

0๐Ÿ‘

You can try https://github.com/cuongnb14/django-admin-extended. Just install follow instructions at https://github.com/cuongnb14/django-admin-extended#readme

Default it slipt each inline model to one tab, if you want all inline models to only one tab you can modify code at admin_extended/templates/admin/change_form.html. It uses jquery-ui and you can easy to do it. Image demo

๐Ÿ‘คJayce

Leave a comment