diff options
author | luxagraf <sng@luxagraf.net> | 2025-04-07 19:20:04 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2025-04-07 19:20:04 -0500 |
commit | 33a7287ee0d4571104575b7db1dfbc0d9467aaf9 (patch) | |
tree | 8f6eb350eb67a9b9e09d405a6a4dd5f767630ce7 /app/notes | |
parent | 81aa0bb69e89590c78a001dd42c8735b80ff224a (diff) |
notes: added tags to admin
Diffstat (limited to 'app/notes')
-rw-r--r-- | app/notes/admin.py | 2 | ||||
-rw-r--r-- | app/notes/models.py | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/app/notes/admin.py b/app/notes/admin.py index 2c099ca..931e2e0 100644 --- a/app/notes/admin.py +++ b/app/notes/admin.py @@ -9,7 +9,7 @@ from .models import ( @admin.register(LuxNote) class LuxNoteAdmin(admin.ModelAdmin): - list_display = ('title', 'admin_link', 'date_created') + list_display = ('title', 'admin_link', 'date_created', 'admin_tags') search_fields = ['title', 'description', 'url'] list_filter = [TagListFilter] fieldsets = ( diff --git a/app/notes/models.py b/app/notes/models.py index c0c88e8..eb3faeb 100644 --- a/app/notes/models.py +++ b/app/notes/models.py @@ -37,5 +37,12 @@ class LuxNote(models.Model): self.body_html = markdown_to_html(self.body_markdown) super(LuxNote, self).save(*args, **kwargs) + 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' + def get_absolute_url(self, *args, **kwargs): return reverse('notes:note-edit', kwargs={"pk": self.pk}) |