From 399ed573fb147fd49eb2e3b1e7abf89e5880e3cc Mon Sep 17 00:00:00 2001 From: Felipe Henrique de Almeida Bormann Date: Thu, 26 Jan 2017 17:00:33 -0300 Subject: [PATCH] search now accepts unaccent items and template problems were solved --- subjects/templates/subjects/list_search.html | 35 +++++++++++++++++++++++++++++------ subjects/views.py | 2 +- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/subjects/templates/subjects/list_search.html b/subjects/templates/subjects/list_search.html index 7630f33..4f6ebaf 100644 --- a/subjects/templates/subjects/list_search.html +++ b/subjects/templates/subjects/list_search.html @@ -13,6 +13,28 @@ {% endblock breadcrumbs %} + {% block sidebar %} + + {% endblock %} + {% block content %} {% if messages %} @@ -26,7 +48,11 @@ {% endfor %} {% endif %} - + {% if subjects|length > 0 %} +

{% trans "Search results" %}:

+ {% else %} +

{% trans "Search results" %}: {% trans " any subjects or resources were found on the search for " %} {{tags}}

+ {% endif %}
-

{% trans "Search results" %}:

+
@@ -54,10 +80,7 @@ {% pagination request paginator page_obj %}
{% else %} -
- -

{% trans 'You still do not posses any subject in our platform' %}

-
+ {% endif %} diff --git a/subjects/views.py b/subjects/views.py index 87bef08..d4714b7 100644 --- a/subjects/views.py +++ b/subjects/views.py @@ -597,7 +597,7 @@ class SubjectSearchView(LoginRequiredMixin, LogMixin, ListView): self.tags = tags tags = tags.split(" ") - subjects = Subject.objects.filter(tags__name__in=tags) + subjects = Subject.objects.filter(tags__name__unaccent__in=tags) #pk = self.request.user.pk #my_subjects = Subject.objects.filter(Q(students__pk=pk) | Q(professor__pk=pk) | Q(category__coordinators__pk=pk) & Q(tags__name__in=tags) ).distinct() -- libgit2 0.21.2