# HG changeset patch # User cavaliet # Date 1411987420 -7200 # Node ID 12b6fc19d78f3ff98cf74650bcd2a208e0ce852e # Parent a0fa17c4823609af0e68a2dadcb13d289bb0bb8a better filter management diff -r a0fa17c48236 -r 12b6fc19d78f src/hdalab/static/hdalab/css/profile.css --- a/src/hdalab/static/hdalab/css/profile.css Fri Sep 26 12:55:35 2014 +0200 +++ b/src/hdalab/static/hdalab/css/profile.css Mon Sep 29 12:43:40 2014 +0200 @@ -25,6 +25,13 @@ .inline{ display: inline-block; } +#advanced-form{ + border-bottom:1pt solid #555; + border-top:1pt solid #555; +} +#advanced-form p{ + font-size: 12px; +} /* editorialisation part */ .hand_cursor { diff -r a0fa17c48236 -r 12b6fc19d78f src/hdalab/templates/editorial/manage_renkans.html --- a/src/hdalab/templates/editorial/manage_renkans.html Fri Sep 26 12:55:35 2014 +0200 +++ b/src/hdalab/templates/editorial/manage_renkans.html Mon Sep 29 12:43:40 2014 +0200 @@ -13,21 +13,49 @@ {% endblock %} +{% block js_import %} +{{block.super}} + + +{% endblock %} + {% block main_content %} -
{% if page.has_previous %}{% trans 'Previous' %}{% endif %} - {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}
- +{% if page.has_previous %}{% trans 'Previous' %}{% endif %} + {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}
+ +| {% trans 'Title' %} + | {% trans 'Title' %} {% if sort_param == 'title' %}{% endif %} | -{% trans 'User' %} + | {% trans 'User' %} {% if sort_param == 'user' %}{% endif %} | -{% trans 'Modification date' %} + | {% trans 'Modification date' %} {% if sort_param == 'date' %}{% endif %} | {% trans 'Preview' %} | -{% trans 'State' %} + | {% trans 'State' %} {% if sort_param == 'state' %}{% endif %} | {% trans 'Actions' %} |
|---|
{% if page.has_previous %}{% trans 'Previous' %}{% endif %} - {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}
+{% if page.has_previous %}{% trans 'Previous' %}{% endif %} + {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}
{% endblock %} \ No newline at end of file diff -r a0fa17c48236 -r 12b6fc19d78f src/hdalab/templates/profile_home.html --- a/src/hdalab/templates/profile_home.html Fri Sep 26 12:55:35 2014 +0200 +++ b/src/hdalab/templates/profile_home.html Mon Sep 29 12:43:40 2014 +0200 @@ -20,18 +20,18 @@Nouveau Renkan - Modification du mot de passe
Mes renkans :
-{% if page.has_previous %}{% trans 'Previous' %}{% endif %} - {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}
- +{% if page.has_previous %}{% trans 'Previous' %}{% endif %} + {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}
+| {% trans 'Title' %} + | {% trans 'Title' %} {% if sort_param == 'title' %}{% endif %} | -{% trans 'Modification date' %} + | {% trans 'Modification date' %} {% if sort_param == 'date' %}{% endif %} | {% trans 'Preview' %} | -{% trans 'State' %} + | {% trans 'State' %} {% if sort_param == 'state' %}{% endif %} | {% trans 'Actions' %} |
|---|
{% if page.has_previous %}{% trans 'Previous' %}{% endif %} - {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}
+{% if page.has_previous %}{% trans 'Previous' %}{% endif %} + {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}
{% endblock %} \ No newline at end of file diff -r a0fa17c48236 -r 12b6fc19d78f src/hdalab/templates/renkan_list.html --- a/src/hdalab/templates/renkan_list.html Fri Sep 26 12:55:35 2014 +0200 +++ b/src/hdalab/templates/renkan_list.html Mon Sep 29 12:43:40 2014 +0200 @@ -15,16 +15,16 @@ {% block renkans_actif %}actif{% endblock %} {% block main_content %} -{% if page.has_previous %}{% trans 'Previous' %}{% endif %} - {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}
- +{% if page.has_previous %}{% trans 'Previous' %}{% endif %} + {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}
+| {% trans 'Title' %} + | {% trans 'Title' %} {% if sort_param == 'title' %}{% endif %} | -{% trans 'Modification date' %} + | {% trans 'Modification date' %} {% if sort_param == 'date' %}{% endif %} | Preview | Actions |
|---|
{% if page.has_previous %}{% trans 'Previous' %}{% endif %} - {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}
+{% if page.has_previous %}{% trans 'Previous' %}{% endif %} + {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}
{% endblock %} \ No newline at end of file diff -r a0fa17c48236 -r 12b6fc19d78f src/hdalab/views/profile.py --- a/src/hdalab/views/profile.py Fri Sep 26 12:55:35 2014 +0200 +++ b/src/hdalab/views/profile.py Mon Sep 29 12:43:40 2014 +0200 @@ -45,9 +45,33 @@ def update_context(self, context, renkan_queryset): - filter_title = self.request.GET.get("filter", "") + filters = "" + filter_title = self.request.GET.get("title", "") if(len(filter_title)>0): renkan_queryset = renkan_queryset.filter(renkan__title__icontains=filter_title) + filters += "&title=" + filter_title + filter_username = self.request.GET.get("username", "") + if(len(filter_username)>0): + renkan_queryset = renkan_queryset.filter(renkan__owner__username=filter_username) + filters += "&username=" + filter_username + filter_state = self.request.GET.get("state", "") + if(len(filter_state)>0): + try: + filter_state = int(filter_state) + except: + pass + renkan_queryset = renkan_queryset.filter(state=filter_state) + filter_state = str(filter_state) + filters += "&state=" + filter_state + filter_startdate = self.request.GET.get("startdate", "") + if filter_startdate!="": + renkan_queryset = renkan_queryset.filter(renkan__modification_date__gt=filter_startdate) + filters += "&startdate=" + filter_startdate + filter_enddate = self.request.GET.get("enddate", "") + if filter_enddate!="": + renkan_queryset = renkan_queryset.filter(renkan__modification_date__lt=filter_enddate + " 23:59:59") + filters += "&enddate=" + filter_enddate + sort_param = self.request.GET.get('sort', "date") order_param = self.request.GET.get('order', "desc") @@ -69,7 +93,9 @@ except EmptyPage: page = p.page(p.num_pages) - context.update({"page": page, "sort_param":sort_param, "order_param":order_param, "opposite":opposite, "filter":filter_title}) + context.update({"page": page, "sort_param":sort_param, "order_param":order_param, "opposite":opposite, + "filters":filters, "title": filter_title, "username": filter_username, "state": filter_state, + "startdate":filter_startdate, "enddate":filter_enddate}) return context