farridav / django-jazzmin

Jazzy theme for Django
https://django-jazzmin.readthedocs.io
MIT License
1.63k stars 285 forks source link

Horizontal layout of the input forms #597

Open SultanovvAsadbek opened 1 month ago

SultanovvAsadbek commented 1 month ago

Screenshot from 2024-09-08 14-39-51 I would like the input form to be located not under the title, but to the right of it.

Screenshot from 2024-09-08 14-52-22

Tchy258 commented 1 month ago

You can do this within a django ModelAdmin class by nesting the fields you want in the same row as a tuple in the fieldsets property, it's unrelated to jazzmin itself.

class MyModelAdmin(admin.ModelAdmin):
    fieldsets = (
        ('Some name', {
            'fields': ( 
                ('first field', 'second field',),)
        }),
    )

If it's an inline admin model, the same logic applies, in your particular case it should be something like this

class UnitInline(admin.StackedInline):
    model = Unit # This is where your model class goes
    verbose_name_plural = "Some name" # This is how you want the tab to be named like
    fieldsets = (
        (None, {
            'fields': (
                ('title','type',),
            ),
        }),
    )