Saturday, September 9, 2017

Add checkbox and delete actions to customized Django admin change_list

Leave a Comment

I've been customizing Django's change_list.html following this tutorial. My question concerns something that wasn't covered in that tutorial:

How to easily add the checkbox and the actions (delete selected items)?

I took a look in the templatetags of the admin section (mainly here, but I couldn't understand how to easily add the delete action to each item in a customized change_list.html template and what should be added to the ModelAdmin class).

Update:

Below is the custom change_list.html, I'm trying to add item checkboxes to:

{% extends "admin/change_list.html" %}  {% block content_title %}     <h1>Title</h1> {% endblock %}  {% block result_list %}     <div class="results">         <table id="result_list">             <thead>                 ...             </thead>              <tbody>                 {% for item in items %}                     <tr class="{% cycle 'row1' 'row2' %}">                         ...                     </tr>                 {% endfor %}             </tbody>         </table>     </div> {% endblock %} 

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment