obj_list.html 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {% extends '_base.html' %}
  2. {% load buttons %}
  3. {% load helpers %}
  4. {% block content %}
  5. <div class="pull-right noprint">
  6. {% block buttons %}{% endblock %}
  7. {% if permissions.add and 'add' in action_buttons %}
  8. {% add_button content_type.model_class|url_name:"add" %}
  9. {% endif %}
  10. {% if permissions.add and 'import' in action_buttons %}
  11. {% import_button content_type.model_class|url_name:"import" %}
  12. {% endif %}
  13. {% if 'export' in action_buttons %}
  14. {% export_button content_type %}
  15. {% endif %}
  16. </div>
  17. <h1>{% block title %}{{ content_type.model_class|model_name_plural|bettertitle }}{% endblock %}</h1>
  18. <div class="row">
  19. <div class="col-md-9">
  20. {% with bulk_edit_url=content_type.model_class|url_name:"bulk_edit" bulk_delete_url=content_type.model_class|url_name:"bulk_delete" %}
  21. {% if permissions.change or permissions.delete %}
  22. <form method="post" class="form form-horizontal">
  23. {% csrf_token %}
  24. <input type="hidden" name="return_url" value="{% if return_url %}{{ return_url }}{% else %}{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}{% endif %}" />
  25. {% if table.paginator.num_pages > 1 %}
  26. <div id="select_all_box" class="hidden panel panel-default noprint">
  27. <div class="panel-body">
  28. <div class="checkbox-inline">
  29. <label for="select_all">
  30. <input type="checkbox" id="select_all" name="_all" />
  31. Select <strong>all {{ table.rows|length }} {{ table.data.verbose_name_plural }}</strong> matching query
  32. </label>
  33. </div>
  34. <div class="pull-right">
  35. {% if bulk_edit_url and permissions.change %}
  36. <button type="submit" name="_edit" formaction="{% url bulk_edit_url %}{% if bulk_querystring %}?{{ bulk_querystring }}{% elif request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-warning btn-sm" disabled="disabled">
  37. <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit All
  38. </button>
  39. {% endif %}
  40. {% if bulk_delete_url and permissions.delete %}
  41. <button type="submit" name="_delete" formaction="{% url bulk_delete_url %}{% if bulk_querystring %}?{{ bulk_querystring }}{% elif request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-danger btn-sm" disabled="disabled">
  42. <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete All
  43. </button>
  44. {% endif %}
  45. </div>
  46. </div>
  47. </div>
  48. {% endif %}
  49. {% include table_template|default:'responsive_table.html' %}
  50. <div class="pull-left noprint">
  51. {% block bulk_buttons %}{% endblock %}
  52. {% if bulk_edit_url and permissions.change %}
  53. <button type="submit" name="_edit" formaction="{% url bulk_edit_url %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-warning btn-sm">
  54. <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit Selected
  55. </button>
  56. {% endif %}
  57. {% if bulk_delete_url and permissions.delete %}
  58. <button type="submit" name="_delete" formaction="{% url bulk_delete_url %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-danger btn-sm">
  59. <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete Selected
  60. </button>
  61. {% endif %}
  62. </div>
  63. </form>
  64. {% else %}
  65. {% include table_template|default:'responsive_table.html' %}
  66. {% endif %}
  67. {% endwith %}
  68. {% include 'inc/paginator.html' with paginator=table.paginator page=table.page %}
  69. <div class="clearfix"></div>
  70. </div>
  71. <div class="col-md-3 noprint">
  72. {% if filter_form %}
  73. {% include 'inc/search_panel.html' %}
  74. {% endif %}
  75. {% block sidebar %}{% endblock %}
  76. </div>
  77. </div>
  78. {% endblock %}