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):
class Meta:
db_table = 'wp_esi_ml_data'
......@@ -13,20 +13,29 @@
<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>
<label>Date: </label>
{% if request.GET.from_date %}
<input type="date" name="from_date" value="{{ request.GET.from_date }}">
{% else %}
<input type="date" name="from_date" value="{{ date.publish_date__min }}">
{% endif %}
{% if request.GET.to_date %}
<input type="date" name="to_date" value="{{ request.GET.to_date }}">
{% else %}
<input type="date" name="to_date" value="{{ date.publish_date__max }}">
{% endif %}
<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>
......@@ -53,27 +62,30 @@
<tr>
<th><a class="text-white" href="?order_by=title">
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">
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">
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">
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">
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>
</thead>
<tbody>
{% if not news %}
<tr><td><h3>Not found</h3></td></tr>
<tr>
<td><h3>Not found</h3></td>
</tr>
{% endif %}
{% for i in news %}
<tr id="{{ i.id }}">
......@@ -87,9 +99,13 @@
<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="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>
<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>
......
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