More Complex Layouts

Learn how to customize the layout and ordering of data in the Django admin page.

We'll cover the following

Fieldsets

You will also have fieldsets to control the layout of the admin page when you are adding or changing an Author. Usually, the fields that are displayed are the ones that you have created in your model instance.

You can see the creation or updated form by clicking on a specific author. If you want to display a specific label before fields in the edit form, you will create it as a tuple inside fieldsets. For example, if you want to display the name of the author under the section “Author Info”, you can do that with the following:

fieldsets = [
    ("Author Info:", {'fields':['name']}),
]

And this will look something like the following:

Get hands-on with 1200+ tech skills courses.