Skip to content

Commit

Permalink
django-taggit-911 - order tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Trafire committed Jul 28, 2024
1 parent 5ec2151 commit 38758ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!-- Path: `library_management/templates/library_management/author_detail.html` -->
{% extends "library_management/base.html" %}
{% load custom_filters %}

{% block title %}Author Detail{% endblock %}

Expand All @@ -9,7 +10,7 @@ <h1 class="my-4">{{ author.full_name }}</h1>
<p>{{ author.biography }}</p>
<h2>Tags</h2>
<ul>
{% for tag in author.tags.all %}
{% for tag in author.tags.all|order_tags %}
<li>{{ tag.name }}</li>
{% endfor %}
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
@register.filter
def classname(obj):
return obj.__class__.__name__

@register.filter
def order_tags(tags):
return tags.order_by('name')

0 comments on commit 38758ac

Please sign in to comment.