The decorator would set ``request.cms_toolbar`` to whatever class it
defines. the custom toolbar class would set it's custom items. Further you
can always just manipulate the items in the view using
``request.cms_toolbar...``


On Mon, Apr 29, 2013 at 11:21 PM, Patrick Lauber
<notifications@github.com>wrote:

> In docs/extending_cms/app_integration.rst:
>
> > +    from django.core.urlresolvers import reverse
> > +    from django.utils.translation import ugettext_lazy as _
> > +
> > +
> > +    class CategoryToolbar(CMSToolbar):
> > +        def insert_items(self, items, toolbar, request, is_app):
> > +            if request.user.is_staff:
> > +                items[0].items = [Item(reverse('admin:sampleapp_category_changelist'), _('Categories'),
> > +                                       load_side_frame=True)] + items[0].items
> > +                if is_app:
> > +                    cat_list = List(reverse('admin:sampleapp_category_changelist'), _('Category'))
> > +                    cat_list.items.append(Item(reverse('admin:sampleapp_category_add'), _("Add Category")))
> > +                    items.append(cat_list)
> > +
> > +
> > +    toolbar_pool.register(CategoryToolbar)
>
> So a decorator overwrites the default toolbar? From where? When the
> decorator is never called? And how should a decorator know what item the
> view wants to add to the toolbar?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/divio/django-cms/pull/1744/files#r3999257>
> .
>