[Django]-How to show multiple fields within a row? (Django Admin)

1👍

I don’t understand what info you want to get in a cell, but want to suggest you to use the next approach:

class floAdmin(admin.ModelAdmin):

    list_display = ('especie', 'familia', 'regiaopred', 'emailautor', 'aprovado', 'datacriado', 'especie_0', 'custom_field', )
    fieldsets = (
        ('Editar:', {
            'fields': ('especie', 'familia', 'regiaopred', 'emailautor', 'aprovado', 'datacriado', 'especie_0', 'custom_field', )
            }),
        )

    def custom_field(self, obj):
        data_list_to_show = []  # get data based on obj
        return data_list_to_show 

1👍

If I true understood) because I had the same problem. This helped me:

fieldsets=(        
       ("My Group",{"fields": (tuple(['field1','field1']),),}), 
    )

Wrap those fields on their own tuple. There was answer Django admin display multiple fields on the same line

Leave a comment