tomjerry
tomjerry

Reputation: 217

Dynamically customize django admin columns?

Is it possible to let the users choose / change dynamically the columns displayed in a object list in Django administration ?

Things can surely be implemented "from scratch" by modifying the 'change_list.html' template but I was wondering if somebody has already had the same problem and/or if any django-pluggin can do that.

Thanks in advance,

Upvotes: 7

Views: 5325

Answers (3)

Andy Baker
Andy Baker

Reputation: 21567

Since Django 1.4 you can do this using get_list_display(): https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_list_display

Upvotes: 4

CDMP
CDMP

Reputation: 310

django-xadmin has this feature:

django x-admin dynamic columns

It has some other cool features too, but I haven't started using it because the English translation of the documentation hasn't been released yet (as of Oct '13). You could look at the source code to give you some ideas.

Check out the live demo

User: admin Password: admin

Note: I have no involvement in x-admin, I just have the same question as the OP.

Upvotes: 3

Matt Boehm
Matt Boehm

Reputation: 1912

If I've interpreted your question correctly, the solution is to set list_display in your extension of ModelAdmin for that object. Refer to the Django Tutorial, Part 2.

Upvotes: 0

Related Questions