Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

cms toolbars added for aldryn-categories #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions aldryn_categories/cms_toolbars.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from django.utils.translation import ugettext_lazy as _
from cms.toolbar_pool import toolbar_pool
from cms.toolbar_base import CMSToolbar
from cms.utils.urlutils import admin_reverse
from .models import Category

class CategoryToolbar(CMSToolbar):
supported_apps = (
'aldryn_categories',
)

watch_models = [Category]

def populate(self):

menu = self.toolbar.get_or_create_menu('aldryn_categorie-app', _('Categories'))

menu.add_modal_item(
name=_('Add new Category'),
url=admin_reverse('aldryn_categories_category_add'),
)

menu.add_sideframe_item(
name=_('Categories list'),
url=admin_reverse('aldryn_categories_category_changelist'),
)



toolbar_pool.register(CategoryToolbar)