Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you add parameters to Django custom admin actions?

Tags:

For example (not the case, but just to illustrate) if I wanted to add an action to set a specific field in the selected items to X. Is it possible to add an action to allow X to be entered as opposed to hard coded?

like image 626
nickponline Avatar asked Aug 01 '12 17:08

nickponline


People also ask

Can we customize Django admin panel?

The Django admin is a powerful built-in tool giving you the ability to create, update, and delete objects in your database using a web interface. You can customize the Django admin to do almost anything you want.

How do I restrict access to parts of Django admin?

Django admin allows access to users marked as is_staff=True . To disable a user from being able to access the admin, you should set is_staff=False . This holds true even if the user is a superuser. is_superuser=True .

What is Fieldsets in Django admin?

It's just a way for you to be able to group the fields on a Model Admin Page. Just implement the example in the documentation and it should become apparent for you.


1 Answers

See: Actions that Provide Intermediate Pages

You can't do it right from the changelist page, but on your intermediate page, you could have a form that would allow the user to enter a value, and then use that value for the action.

like image 145
Chris Pratt Avatar answered Sep 20 '22 19:09

Chris Pratt