fixed list
This commit is contained in:
@@ -14,7 +14,7 @@ import from https://tutorial.djangogirls.org/en/template_extending/
|
||||
</div>
|
||||
{% else %}
|
||||
<a class="btn btn-outline-dark" href="{% url 'post_publish' pk=post.pk %}">Publish</a>
|
||||
<!-- imported end -->
|
||||
<!-- imported end -->
|
||||
|
||||
{% endif %} {% if user.is_staff and user == post.author %}
|
||||
|
||||
@@ -29,21 +29,16 @@ import from https://tutorial.djangogirls.org/en/template_extending/
|
||||
<h1>{{ post.title }}</h1>
|
||||
<p>{{ post.text|linebreaksbr }}</p>
|
||||
<!-- imported end -->
|
||||
<p>
|
||||
Tags:
|
||||
{% for tag in post.tags.all %}
|
||||
<a href="{% url 'search_add' %}">{{ tag.name }} </a>
|
||||
{% if not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
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 }}
|
||||
{% if user.is_staff %}
|
||||
<p>
|
||||
{% get_hit_count for post %} Benutzer haben diesen Post bereits gelesen!
|
||||
</p>
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>
|
||||
Autor: {{ post.author }}
|
||||
</p>
|
||||
{% if user.is_staff %}
|
||||
<p>
|
||||
{% get_hit_count for post %} Benutzer haben diesen Post bereits gelesen!
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -123,13 +123,15 @@ def post_remove(request, pk):
|
||||
def tag_list(request):
|
||||
log = logging.getLogger('mysite')
|
||||
u = User.objects.get(username=request.user)
|
||||
posts = Post.objects.none()
|
||||
if u:
|
||||
tags_user = Tag.objects.filter(customuser__user = u)
|
||||
log.info(tags_user)
|
||||
for tag in tags_user:
|
||||
posts = Post.objects.filter(tags__in=[tag]).order_by('-published_date')
|
||||
query = Post.objects.filter(tags__in=[tag]).order_by('-published_date')
|
||||
posts = posts | query
|
||||
log.info(posts)
|
||||
return render(request, 'tag_list.html', locals())
|
||||
return render(request, 'tag_list.html', {'posts': posts})
|
||||
|
||||
@login_required
|
||||
def search_add(request):
|
||||
|
||||
Reference in New Issue
Block a user