Commit b577fc65 authored by Vasyl Bodnaruk's avatar Vasyl Bodnaruk

Fix date on filter field

parent e38a8792
...@@ -107,3 +107,4 @@ class MLData(models.Model): ...@@ -107,3 +107,4 @@ class MLData(models.Model):
class Meta: class Meta:
db_table = 'wp_esi_ml_data' db_table = 'wp_esi_ml_data'
...@@ -13,20 +13,29 @@ ...@@ -13,20 +13,29 @@
<div class="collapse navbar-collapse" id="navbarTogglerDemo01"> <div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<div class="actions mr-auto"> <div class="actions mr-auto">
<form class="actions-form" method="get" action="{% url 'list_news' %}"> <form class="actions-form" method="get" action="{% url 'list_news' %}">
<label>Date: </label> <label>Date: </label>
<input type="date" name="from_date" value="{{ date.publish_date__min }}"> {% if request.GET.from_date %}
<input type="date" name="to_date" value="{{ date.publish_date__max }}"> <input type="date" name="from_date" value="{{ request.GET.from_date }}">
<label>Media:</label> {% else %}
<select class="form-control actions-select" name="media"> <input type="date" name="from_date" value="{{ date.publish_date__min }}">
<option>All</option> {% endif %}
{% for i in media %} {% if request.GET.to_date %}
<option>{{ i.name }}</option> <input type="date" name="to_date" value="{{ request.GET.to_date }}">
{% endfor %} {% else %}
</select> <input type="date" name="to_date" value="{{ date.publish_date__max }}">
<button type="submit" class="btn btn-success">Filter</button> {% endif %}
<div style="display: block;">
<input type="text" name="search" placeholder="Enter search ..."> <label>Media:</label>
</div> <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> </form>
</div> </div>
...@@ -53,27 +62,30 @@ ...@@ -53,27 +62,30 @@
<tr> <tr>
<th><a class="text-white" href="?order_by=title"> <th><a class="text-white" href="?order_by=title">
Title {% if request.GET.order_by == 'title' and request.GET.reverse != '1' %}&uarr; Title {% if request.GET.order_by == 'title' and request.GET.reverse != '1' %}&uarr;
{% elif request.GET.order_by == 'title' and request.GET.reverse == '1' %}&darr;{% endif %}</a></th> {% elif request.GET.order_by == 'title' and request.GET.reverse == '1' %}&darr;{% endif %}</a></th>
<th><a class="text-white" href="?order_by=media_id"> <th><a class="text-white" href="?order_by=media_id">
Media {% if request.GET.order_by == 'media_id' and request.GET.reverse != '1' %}&uarr; Media {% if request.GET.order_by == 'media_id' and request.GET.reverse != '1' %}&uarr;
{% elif request.GET.order_by == 'media_id' and request.GET.reverse == '1' %}&darr;{% endif %}</a></th> {% elif request.GET.order_by == 'media_id' and request.GET.reverse == '1' %}&darr;{% endif %}</a></th>
<th><a class="text-white" href="?order_by=type_id"> <th><a class="text-white" href="?order_by=type_id">
Type {% if request.GET.order_by == 'type_id' and request.GET.reverse != '1' %}&uarr; Type {% if request.GET.order_by == 'type_id' and request.GET.reverse != '1' %}&uarr;
{% elif request.GET.order_by == 'type_id' and request.GET.reverse == '1' %}&darr;{% endif %}</a></th> {% elif request.GET.order_by == 'type_id' and request.GET.reverse == '1' %}&darr;{% endif %}</a></th>
<th><a class="text-white" href="?order_by=region_id"> <th><a class="text-white" href="?order_by=region_id">
Region {% if request.GET.order_by == 'region_id' and request.GET.reverse != '1' %}&uarr; Region {% if request.GET.order_by == 'region_id' and request.GET.reverse != '1' %}&uarr;
{% elif request.GET.order_by == 'region_id' and request.GET.reverse == '1' %}&darr;{% endif %}</a></th> {% elif request.GET.order_by == 'region_id' and request.GET.reverse == '1' %}&darr;{% endif %}</a></th>
<th><a class="text-white" href="?order_by=publish_date"> <th><a class="text-white" href="?order_by=publish_date">
Publish date {% if request.GET.order_by == 'publish_date' and request.GET.reverse != '1' %}&uarr; Publish date {% if request.GET.order_by == 'publish_date' and request.GET.reverse != '1' %}&uarr;
{% elif request.GET.order_by == 'publish_date' and request.GET.reverse == '1' %}&darr;{% endif %}</a></th> {% elif request.GET.order_by == 'publish_date' and request.GET.reverse == '1' %}&darr;{% endif %}</a>
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% if not news %} {% if not news %}
<tr><td><h3>Not found</h3></td></tr> <tr>
<td><h3>Not found</h3></td>
</tr>
{% endif %} {% endif %}
{% for i in news %} {% for i in news %}
<tr id="{{ i.id }}"> <tr id="{{ i.id }}">
...@@ -87,9 +99,13 @@ ...@@ -87,9 +99,13 @@
<a href="{% url 'edit_news' i.id %}" data-type="edit" <a href="{% url 'edit_news' i.id %}" data-type="edit"
class="action-block-edit"><strong>Edit</strong></a> class="action-block-edit"><strong>Edit</strong></a>
<span class="divider">|</span> <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="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="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> <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 %} {% endif %}
</div> </div>
</td> </td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment