Commit 399ed573fb147fd49eb2e3b1e7abf89e5880e3cc

Authored by Felipe Henrique de Almeida Bormann
1 parent bf718cf8

search now accepts unaccent items and template problems were solved

subjects/templates/subjects/list_search.html
@@ -13,6 +13,28 @@ @@ -13,6 +13,28 @@
13 13
14 {% endblock breadcrumbs %} 14 {% endblock breadcrumbs %}
15 15
  16 + {% block sidebar %}
  17 + <ul id="sidebar-menu">
  18 + <li class="item " id="subjects-link" data-toggle="tooltip" data-placement="right" title="{% trans "Subjects" %}">
  19 + <a href="{% url 'subjects:index' %}">
  20 + <i class="fa fa-graduation-cap" aria-hidden="true"></i>
  21 + </a>
  22 + </li>
  23 + <li class="item" data-toggle="tooltip" data-placement="right" title="{% trans "Timeline" %}">
  24 + <i class="fa fa-list" aria-hidden="true" ></i>
  25 + </li>
  26 + <li class="item" data-toggle="tooltip" data-placement="right" title="{% trans "Messages" %}">
  27 + <i class="fa fa-envelope-o" aria-hidden="true"></i>
  28 + </li>
  29 + <li class="item" data-toggle="tooltip" data-placement="right" title="{% trans "Pendencias" %}">
  30 + <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
  31 + </li>
  32 + <li class="item" data-toggle="tooltip" data-placement="right" title="{% trans "Analytics" %}">
  33 + <i class="fa fa-bar-chart" aria-hidden="true"></i>
  34 + </li>
  35 + </ul>
  36 + {% endblock %}
  37 +
16 {% block content %} 38 {% block content %}
17 39
18 {% if messages %} 40 {% if messages %}
@@ -26,7 +48,11 @@ @@ -26,7 +48,11 @@
26 </script> 48 </script>
27 {% endfor %} 49 {% endfor %}
28 {% endif %} 50 {% endif %}
29 - 51 + {% if subjects|length > 0 %}
  52 + <p id="search-results-title">{% trans "Search results" %}:</p>
  53 + {% else %}
  54 + <p id="search-results-title">{% trans "Search results" %}: {% trans " any subjects or resources were found on the search for " %} {{tags}} </p>
  55 + {% endif %}
30 <div id="core-subjects-options-div"> 56 <div id="core-subjects-options-div">
31 <ul class="core-subjects-options"> 57 <ul class="core-subjects-options">
32 {% if all %} 58 {% if all %}
@@ -40,7 +66,7 @@ @@ -40,7 +66,7 @@
40 </ul> 66 </ul>
41 </div> 67 </div>
42 68
43 - <p id="search-results-title">{% trans "Search results" %}:</p> 69 +
44 70
45 <div class="col-md-12 cards-content"> 71 <div class="col-md-12 cards-content">
46 72
@@ -54,10 +80,7 @@ @@ -54,10 +80,7 @@
54 {% pagination request paginator page_obj %} 80 {% pagination request paginator page_obj %}
55 </div> 81 </div>
56 {% else %} 82 {% else %}
57 - <div class="text-center no-subjects">  
58 - <i class="fa fa-graduation-cap"></i>  
59 - <h4>{% trans 'You still do not posses any subject in our platform' %}</h4>  
60 - </div> 83 +
61 {% endif %} 84 {% endif %}
62 </div> 85 </div>
63 86
subjects/views.py
@@ -597,7 +597,7 @@ class SubjectSearchView(LoginRequiredMixin, LogMixin, ListView): @@ -597,7 +597,7 @@ class SubjectSearchView(LoginRequiredMixin, LogMixin, ListView):
597 self.tags = tags 597 self.tags = tags
598 tags = tags.split(" ") 598 tags = tags.split(" ")
599 599
600 - subjects = Subject.objects.filter(tags__name__in=tags) 600 + subjects = Subject.objects.filter(tags__name__unaccent__in=tags)
601 #pk = self.request.user.pk 601 #pk = self.request.user.pk
602 #my_subjects = Subject.objects.filter(Q(students__pk=pk) | Q(professor__pk=pk) | Q(category__coordinators__pk=pk) & Q(tags__name__in=tags) ).distinct() 602 #my_subjects = Subject.objects.filter(Q(students__pk=pk) | Q(professor__pk=pk) | Q(category__coordinators__pk=pk) & Q(tags__name__in=tags) ).distinct()
603 603