Commit a831f374 authored by Nicolas Joyard's avatar Nicolas Joyard
Browse files

Remove csv testing code and fix sorting mishaps

parent b6ea1339
...@@ -83,11 +83,13 @@ class SortMixin(object): ...@@ -83,11 +83,13 @@ class SortMixin(object):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
c = super(SortMixin, self).get_context_data(**kwargs) c = super(SortMixin, self).get_context_data(**kwargs)
c['sort_querystring'] = copy(self.request.GET) c['sort_by_querystring'] = copy(self.request.GET)
if 'sort_by' in c['sort_querystring']: if 'sort_by' in c['sort_by_querystring']:
del c['sort_querystring']['sort_by'] del c['sort_by_querystring']['sort_by']
if 'sort_dir' in c['sort_querystring']:
del c['sort_querystring']['sort_dir'] c['sort_dir_querystring'] = copy(self.request.GET)
if 'sort_dir' in c['sort_dir_querystring']:
del c['sort_dir_querystring']['sort_dir']
c['sort'] = { c['sort'] = {
'fields': self.sort_fields, 'fields': self.sort_fields,
......
...@@ -11,5 +11,5 @@ ...@@ -11,5 +11,5 @@
</li> </li>
--- ---
<li> <li>
<a href="?&amp;sort_dir=asc">descending</a> <a href="?&amp;sort_dir=desc">descending</a>
</li> </li>
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<ul class="dropdown-menu" aria-labelledby="orderby-button"> <ul class="dropdown-menu" aria-labelledby="orderby-button">
{% for field, label in sort.fields.items %} {% for field, label in sort.fields.items %}
<li {% if sort.field == field %}class="disabled"{% endif %}> <li {% if sort.field == field %}class="disabled"{% endif %}>
<a href="?{{ sort_querystring.urlencode }}&sort_by={{ field }}">{% trans label %}</a> <a href="?{{ sort_by_querystring.urlencode }}&sort_by={{ field }}">{% trans label %}</a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
<ul class="dropdown-menu" aria-labelledby="orderdir-button"> <ul class="dropdown-menu" aria-labelledby="orderdir-button">
<li {% if sort.dir == 'asc' %}class="disabled"{% endif %}> <li {% if sort.dir == 'asc' %}class="disabled"{% endif %}>
<a href="?{{ sort_querystring.urlencode }}&sort_dir=asc">{% trans "ascending" %}</a> <a href="?{{ sort_dir_querystring.urlencode }}&sort_dir=asc">{% trans "ascending" %}</a>
</li> </li>
<li {% if sort.dir == 'desc' %}class="disabled"{% endif %}> <li {% if sort.dir == 'desc' %}class="disabled"{% endif %}>
<a href="?{{ sort_querystring.urlencode }}&sort_dir=asc">{% trans "descending" %}</a> <a href="?{{ sort_dir_querystring.urlencode }}&sort_dir=desc">{% trans "descending" %}</a>
</li> </li>
</ul> </ul>
</div> </div>
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{% endif %} {% endif %}
</div> </div>
<div class="col-sm-4 text-right"> <div class="col-sm-4 text-right">
{% if csv or 1 %} {% if csv %}
<a class="btn btn-default" role="button" href="?{{ csv_querystring.urlencode }}&csv"> <a class="btn btn-default" role="button" href="?{{ csv_querystring.urlencode }}&csv">
{% bootstrap_icon "download-alt" %} {% bootstrap_icon "download-alt" %}
{% trans "Download CSV" %} {% trans "Download CSV" %}
......
Supports Markdown
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