diff options
Diffstat (limited to 'app/links/models.py')
-rw-r--r-- | app/links/models.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/links/models.py b/app/links/models.py index ecea2d9..0255745 100644 --- a/app/links/models.py +++ b/app/links/models.py @@ -3,7 +3,7 @@ import datetime from random import randint from django.template.defaultfilters import striptags from django.urls import reverse -from django.utils.html import format_html +from django.utils.html import format_html, format_html_join from django.apps import apps from django.db import models from django.utils import timezone @@ -86,6 +86,13 @@ class Link(models.Model): return format_html('<a href="%s">Visit Site</a>' % (self.url)) admin_link.short_description = 'Link' + def admin_tags(self): + return format_html_join( + '\n', "<a href='/admin/links/link?tag={}'>{}</a>,", + ((tag.slug, tag.name) for tag in self.tags.all()) + ) + admin_tags.short_description = 'Tags' + @property def get_previous_published(self): return self.get_previous_by_pub_date(status__exact=1) |