diff --git a/application/templates/post_detail.html b/application/templates/post_detail.html index 4b8cca5..19bdf32 100644 --- a/application/templates/post_detail.html +++ b/application/templates/post_detail.html @@ -17,5 +17,7 @@ {% endif %}

{{ post.title }}

{{ post.text|linebreaksbr }}

+

{{ post.tag }}

+ {% endblock %} \ No newline at end of file diff --git a/application/templates/post_list.html b/application/templates/post_list.html index 1693e88..a568515 100644 --- a/application/templates/post_list.html +++ b/application/templates/post_list.html @@ -7,5 +7,10 @@ {{ post.title }}

{{ post.text|linebreaks }}

+ {% for tag in post.tags.all %} +

{{ tag.name }}

+ {% endfor %} + + {% endfor %} {% endblock %} \ No newline at end of file diff --git a/application/templates/student_page.html b/application/templates/student_page.html index da2ed1c..d98c169 100644 --- a/application/templates/student_page.html +++ b/application/templates/student_page.html @@ -6,8 +6,6 @@ -
{{Post.objects.filter(tags__name__in= ["hi"])}} -
diff --git a/application/urls.py b/application/urls.py index 3f455da..6ef8047 100644 --- a/application/urls.py +++ b/application/urls.py @@ -4,6 +4,7 @@ from . import views urlpatterns = [ url(r'^$', views.post_list, name='post_list'), url(r'^student/', views.student_page, name='student_page'), + url(r'^search/', views.blog_search_list_view, name='blog_search_list_view'), url(r'^post/(?P\d+)/$', views.post_detail, name='post_detail'), url(r'^post/new/$', views.post_new, name='post_new'), url(r'^post/(?P\d+)/edit/$', views.post_edit, name='post_edit'), @@ -12,4 +13,3 @@ urlpatterns = [ url(r'^post/(?P\d+)/remove/$', views.post_remove, name='post_remove'), ] -""" url(r'^search/', views.blog_search_list_view, name='blog_search_list_view'), """ diff --git a/application/views.py b/application/views.py index 67eb97c..ad58749 100644 --- a/application/views.py +++ b/application/views.py @@ -112,7 +112,6 @@ def post_remove(request, pk): def student_page(request): return render(request, 'student_page.html', {}) -""" Search for querys def blog_search_list_view(post_list, self): result = super(post_list, self).get_queryset() query = self.request.GET.get('q') @@ -124,4 +123,4 @@ def blog_search_list_view(post_list, self): reduce(operator.and_, (Q(content__icontains=q) for q in query_list)) ) - return result """ \ No newline at end of file + return result \ No newline at end of file