show Taggit tags in Wagtail admin

566 views
Skip to first unread message

Adam Cox

unread,
Jul 28, 2016, 12:17:30 PM7/28/16
to Wagtail support
Is there any way to show taggit tags in the wagtail admin, not talking about a tag field on a page but I want my users to be able to see all tags and edit / delete from wagtail admin?


Tom Dyson

unread,
Jul 28, 2016, 12:20:14 PM7/28/16
to Wagtail support
Hi Adam

You can manage them in the standard Django admin, e.g. yoursite.com/django-admin/taggit/tag/

or you could expose them in the Wagtail admin using modeladmin:


Good luck

Tom

Adam Cox

unread,
Jul 28, 2016, 12:34:22 PM7/28/16
to Wagtail support
Thanks Tom, that worked a treat!

Here's the code for posterity:

wagtail_hooks.py:

#### Tags ####
from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register
from taggit.models import Tag, TaggedItem

class TagsModelAdmin(ModelAdmin):
    model
= Tag
    menu_label
= 'Tags' # ditch this to use verbose_name_plural from model
    menu_icon
= 'tag' # change as required
    menu_order
= 311 # will put in 3rd place (000 being 1st, 100 2nd)
    add_to_settings_menu
= True # or True to add your model to the Settings sub-menu
    list_display
= ["name", "slug"]
   
#list_filter = ('live',)
   
#search_fields = ('title',)

# Now you just need to register your customised ModelAdmin class with Wagtail
modeladmin_register
(TagsModelAdmin)

Fabienheureux

unread,
Nov 28, 2016, 5:59:53 AM11/28/16
to Wagtail support
Thanks a lot Adam, it did help me, still quite new to wagtail ;)
Reply all
Reply to author
Forward
0 new messages