{% extends "base.html" %} {% load el_pagination_tags %} {% block title %} <title>List news</title> {% endblock %} {% block content %} <nav class="navbar navbar-toggleable-md navbar-light bg-faded"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarTogglerDemo01"> <div class="actions mr-auto"> <form class="actions-form" method="get" action="{% url 'list_news' %}"> <label>Date: </label> <input type="date" name="from_date" value="{{ date.publish_date__min }}"> <input type="date" name="to_date" value="{{ date.publish_date__max }}"> <label>Media:</label> <select class="form-control actions-select" name="media"> <option>All</option> {% for i in media %} <option>{{ i.name }}</option> {% endfor %} </select> <button type="submit" class="btn btn-success">Filter</button> <div style="display: block;"> <input type="text" name="search" placeholder="Enter search ..."> </div> </form> </div> <div> {% if user.is_authenticated %} <a href="{% url 'add_news' %}" class="btn btn-primary">Add</a> <button class="js-delete-items btn btn-danger"> <span>Delete(</span><span class="actions-counter">0</span><span>)</span> </button> <button class="js-export-items btn btn-success"> <span>Export(</span><span class="actions-counter">0</span><span>)</span> </button> {% endif %} </div> </div> </nav> {% paginate news %} <form class="form"> <table class="table table-hover"> <thead class="thead-inverse"> <tr> <th><a class="text-white" href="?order_by=title"> Title {% if request.GET.order_by == 'title' and request.GET.reverse != '1' %}↑ {% elif request.GET.order_by == 'title' and request.GET.reverse == '1' %}↓{% endif %}</a></th> <th><a class="text-white" href="?order_by=media_id"> Media {% if request.GET.order_by == 'media_id' and request.GET.reverse != '1' %}↑ {% elif request.GET.order_by == 'media_id' and request.GET.reverse == '1' %}↓{% endif %}</a></th> <th><a class="text-white" href="?order_by=type_id"> Type {% if request.GET.order_by == 'type_id' and request.GET.reverse != '1' %}↑ {% elif request.GET.order_by == 'type_id' and request.GET.reverse == '1' %}↓{% endif %}</a></th> <th><a class="text-white" href="?order_by=region_id"> Region {% if request.GET.order_by == 'region_id' and request.GET.reverse != '1' %}↑ {% elif request.GET.order_by == 'region_id' and request.GET.reverse == '1' %}↓{% endif %}</a></th> <th><a class="text-white" href="?order_by=publish_date"> Publish date {% if request.GET.order_by == 'publish_date' and request.GET.reverse != '1' %}↑ {% elif request.GET.order_by == 'publish_date' and request.GET.reverse == '1' %}↓{% endif %}</a></th> </tr> </thead> <tbody> {% if not news %} <tr><td><h3>Not found</h3></td></tr> {% endif %} {% for i in news %} <tr id="{{ i.id }}"> <td> <span><a href="{% url 'view_news' i.id %}">{{ i.title }}</a></span> <div class="action-block"> {% if user.is_authenticated %} <a href="{% url 'view_news' i.id %}" target="_blank" data-type="view" class="action-block-view"><strong>View</strong></a> <span class="divider">|</span> <a href="{% url 'edit_news' i.id %}" data-type="edit" class="action-block-edit"><strong>Edit</strong></a> <span class="divider">|</span> <span class="action-block-delete"><input id="{{ i.id }}_d" class="checkbox-delete" name="{{ i.id }}" type="radio"><label for="{{ i.id }}_d"><strong>Delete</strong></label></span> <span class="divider">|</span> <span class="action-block-edit"><input id="{{ i.id }}_e" class="checkbox-export" name="{{ i.id }}" type="radio" checked><label for="{{ i.id }}_e"><strong>Export</strong></label></span> {% endif %} </div> </td> <td>{{ i.get_media }}</td> <td>{{ i.get_type }}</td> <td>{{ i.get_region }}</td> <td>{{ i.publish_date }}</td> </tr> {% endfor %} </tbody> </table> </form> <div style="text-align:center"> {% show_pages %} </div> {% endblock %}