[Django]-Django Admin Inlines with many fields, possible to have inline add button create popup?

0๐Ÿ‘

Iโ€™m pretty sure I had somewhat the same issue. My solution was to display two different fieldsets for two different situations.

The ModelAdmin class has a get_fieldsets(self,request, obj=None) functions which i override in my admin.py file.

so something like:

class MiddleInline(admin.TabularInline):
    '''your stuff'''

    def get_fieldsets(self, request, obj=None):
        if obj is None:
            fields = list(('''tuple of the fields you want to display if it's a new object'''))
        else:
            fields = list(('''tuple of the fields you want to display if it's not a new object'''))
        return [(None, {'fields': fields})]

I am not quite entirely sure I got your question right, but I hope this can help!

Leave a comment