Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/templates/tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h2 class="title is-1">Tags</h2>
{% if tags %}
{% for tag in tags %}
<span class="tag box" name="colorpad">
<a href="{% url 'app:tag-links' tag.name %}" class="title is-5">📌 {{ tag.name }}</a>
<a href="{% url 'app:tag-links' tag.tags__name %}" class="title is-5">📌 {{ tag.tags__name }} {{ tag.count }}</a>
</span>&nbsp;
{% endfor %}
{% endif %}
Expand Down
5 changes: 3 additions & 2 deletions app/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import time

from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db.models import Q
from django.db.models import Q, Count
from django.shortcuts import render
from django.views.generic import TemplateView
from taggie.parser import generate_tags
Expand Down Expand Up @@ -73,7 +73,8 @@ def latest(request):

def tags(request):
"""view for the tags"""
tags = Tag.objects.all()
tags = Tutorial.objects.filter(publish=True).values('tags__name').annotate(count=Count('tags'))

context = {
'tags': tags,
'title': 'Tags'
Expand Down