Skip to content

Commit

Permalink
Add tags to Post list admin view
Browse files Browse the repository at this point in the history
  • Loading branch information
VirginiaDooley committed Oct 4, 2023
1 parent 39c6ac5 commit 9f09483
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion democracy_club/apps/hermes/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PostAdmin(admin.ModelAdmin):
filter_horizontal = ["author"]
search_fields = ["subject"]
search_help_text = "Search by subject (Post title)"
list_display = ["subject", "created_on", "category"]
list_display = ["subject", "created_on", "category", "tags"]
list_filter = ["is_published", "author"]


Expand Down
10 changes: 6 additions & 4 deletions democracy_club/templates/hermes/post_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ <h2 class="ds-h3"><a href="{{ post.get_absolute_url }}">{{ post.subject }}</a></
</address>
on <time pubdate datetime="{{post.modified_on|date:"c"}}" title="{{post.created_on|date:"jS E Y"}}">{{post.created_on|date:"jS E Y"}}</time>
</div>
<span aria-hidden="true">🏷️</span>
{% for tag in post.tags %}
<a href="{% url 'hermes_post_list_by_tag' tag %}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
{% endfor %}
<div>
<span aria-hidden="true">🏷️</span>
{% for tag in post.tags %}
<a href="{% url 'hermes_post_list_by_tag' tag %}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
{% endfor %}
</div>
{{ post.rendered_summary|safe|typogrify }}
<a class="ds-cta ds-cta-blue" href="{{ post.get_absolute_url }}">Read more</a>
</article>
Expand Down

0 comments on commit 9f09483

Please sign in to comment.