added post search

This commit is contained in:
Esther Kleinhenz
2018-10-20 23:42:29 +02:00
parent 4a753ff6c9
commit df5d420505
5 changed files with 112 additions and 50 deletions
@@ -1,32 +1,27 @@
{% extends "base.html" %} {% block content %}
{% load taggit_templatetags2_tags %}
{% get_taglist as tags for 'application.post' %}
<div id="">
<ul>
{% for tag in tags %}
<li>{{tag}} ({{tag.num_times}})
</li>
{{ result }}
{% endfor %}
</ul>
</div>
{% include "taggit_templatetags2/tagcanvas_include_js_static.html" %}
<div id="tag-cloud">
</div>
{% get_tagcloud as tags for 'application' %}
{% include_tagcloud 'application.Post' %}
<form type="get" action="." style="margin: 0">
<input id="search_box" type="text" name="search_box" placeholder="Search..." >
<button id="search_submit" type="submit" >Submit</button>
<input id="search_box" type="text" name="search_box" placeholder="Search...">
<button id="search_submit" type="submit">Submit</button>
</form>
<div>
<ul>
{% for tag in tags %}
<li>
{{tag}}
</li>
{% endfor %}
</ul>
{% for post in posts %}
<div class="post">
<div class="date">
{{ post.published_date }}
</div>
<h1>
<a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a>
</h1>
<p>{{ post.text|linebreaks }}</p>
Tags: {% for tag in post.tags.all %}
<a href="{% url 'post_list_by_tag' tag.slug %}">{{ tag.name }}</a>
{% if not forloop.last %}, {% endif %} {% endfor %} <p>
{{ post.author }}
</p>
</div>
{% endfor %}
</div>
{% endblock %}