Commit 399ed573fb147fd49eb2e3b1e7abf89e5880e3cc
1 parent
bf718cf8
Exists in
master
and in
3 other branches
search now accepts unaccent items and template problems were solved
Showing
2 changed files
with
30 additions
and
7 deletions
Show diff stats
subjects/templates/subjects/list_search.html
... | ... | @@ -13,6 +13,28 @@ |
13 | 13 | |
14 | 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 | 38 | {% block content %} |
17 | 39 | |
18 | 40 | {% if messages %} |
... | ... | @@ -26,7 +48,11 @@ |
26 | 48 | </script> |
27 | 49 | {% endfor %} |
28 | 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 | 56 | <div id="core-subjects-options-div"> |
31 | 57 | <ul class="core-subjects-options"> |
32 | 58 | {% if all %} |
... | ... | @@ -40,7 +66,7 @@ |
40 | 66 | </ul> |
41 | 67 | </div> |
42 | 68 | |
43 | - <p id="search-results-title">{% trans "Search results" %}:</p> | |
69 | + | |
44 | 70 | |
45 | 71 | <div class="col-md-12 cards-content"> |
46 | 72 | |
... | ... | @@ -54,10 +80,7 @@ |
54 | 80 | {% pagination request paginator page_obj %} |
55 | 81 | </div> |
56 | 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 | 84 | {% endif %} |
62 | 85 | </div> |
63 | 86 | ... | ... |
subjects/views.py
... | ... | @@ -597,7 +597,7 @@ class SubjectSearchView(LoginRequiredMixin, LogMixin, ListView): |
597 | 597 | self.tags = tags |
598 | 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 | 601 | #pk = self.request.user.pk |
602 | 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 | ... | ... |