Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django admin editing fields in a tabular fashion

I have a model with lots of say CharField fields, that I would like to edit in the admin.

The problem is that each field takes up one line. How should I make them display like this (horizontally): http://docs.djangoproject.com/en/1.1/_images/admin12.png
(source: djangoproject.com)

(they are not foreign keys)

like image 559
styts Avatar asked Feb 22 '10 21:02

styts


People also ask

Can I customize Django admin panel?

You can fully customize the admin by changing the templates used to render pages. The Django template engine has a defined order for loading templates. When it loads a template, it uses the first template that matches the name. You can override admin templates by using the same directory structure and file names.

Is Django admin good for production?

Django's Admin is amazing. A built-in and fully functional interface that quickly gets in and allows data entry is priceless. Developers can focus on building additional functionality instead of creating dummy interfaces to interact with the database.

What we can do in admin portal in Django?

The Django admin application can use your models to automatically build a site area that you can use to create, view, update, and delete records. This can save you a lot of time during development, making it very easy to test your models and get a feel for whether you have the right data.


1 Answers

Django 1.2 has ListEdit extension for the Admin

This is how you use it:

class AccountAdmin(admin.ModelAdmin):
     list_display = ( 'Name','Type')
     list_editable = ( 'Type', )

And this is how it looks like:

alt text
(source: v-lad.org)

like image 118
Vlad Avatar answered Sep 17 '22 21:09

Vlad