it could conditionally import it and replace it with a no-op decorator.


On Mon, Apr 29, 2013 at 11:30 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)
>
> what if you have an app that has optional CMS integration? How would you
> handle it with decorators?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/divio/django-cms/pull/1744/files#r3999434>
> .
>