I want to have a save button on top of django admin change list page. It seems that django don’t have this functionality built-in. The save_on_top option only controls behavior on change form page. Any suggestion is welcome.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First, you need a way to extend the template found at
django/contrib/admin/templates/admin/change_list.html. If you don’t already know how to do that, check out this answer and this answer.Next, you need to create your own
change_list.htmltemplate and put code similar to the following in it. For the sake of simplicity, I’ve included inline CSS. However, this is bad practice, so you should not do it. Assuming you move the CSS to an external file, you won’t need to loadadmin_static. Lastly, theextendsline that you use might not be exactly the same as what I’ve shown here.The
{% if %}tag and the<input>tag inside of it is fromdjango/contrib/admin/templates/admin/pagination.html.The CSS is based on the CSS for
#changelist .paginatorand is found indjango/contrib/admin/static/admin/css/changelists.css.