summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/links/admin.py2
-rw-r--r--app/links/models.py9
2 files changed, 9 insertions, 2 deletions
diff --git a/app/links/admin.py b/app/links/admin.py
index b1aabc0..f967dde 100644
--- a/app/links/admin.py
+++ b/app/links/admin.py
@@ -11,7 +11,7 @@ from .models import Link
@admin.register(Link)
class LinkAdmin(admin.ModelAdmin):
- list_display = ('title', 'admin_link', 'pub_date', 'status')
+ list_display = ('title', 'admin_link', 'pub_date', 'admin_tags')
search_fields = ['title', 'description', 'url']
list_filter = ['status', TagListFilter]
fieldsets = (
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)