# Path: cmsplugin_shop/models.py
# class Category(Node):
#     class Meta:
#         ordering            = ('tree_id', 'lft')
#         verbose_name        = _('category')
#         verbose_name_plural = _('categories')
# 
# class Product(Node):
#     date_added      = models.DateTimeField(_('date added'), auto_now_add=True)
#     last_modified   = models.DateTimeField(_('last modified'), auto_now=True)
#     multiple        = models.IntegerField(_('multiple'), default=1, null=False)
#     unit            = models.CharField(_('unit'), max_length=30, blank=True, null=True)
#     price           = PriceField(_('price'))
#     tax_rate        = TaxRateField(_('tax rate'))
#     related         = models.ManyToManyField('self', _('related products'), blank=True)
#     voucher_exclude = models.BooleanField(_('excluded from vouchers'), default=False)
# 
#     class Meta:
#         ordering            = ('tree_id', 'lft')
#         verbose_name        = _('product')
#         verbose_name_plural = _('products')
# 
#     @property
#     def unit_price(self):
#         return self.price / self.multiple
# 
#     def get_price(self):
#         return Price(self.price, self.tax_rate)
#     get_price.short_description = _('price')
# 
#     @cached_property
#     def all_packages(self):
#         return list(self.packages.all())


from cms.toolbar_base import CMSToolbar
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from .models import Category, Product
from __future__ import absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement



class ShopToolbar(CMSToolbar):
    def populate(self):
        admin_menu = self.toolbar.get_or_create_menu('shop_menu', _('Shop'))
        admin_menu.add_modal_item(_('Add product'), url=reverse('admin:{}_{}_add'.format(Product._meta.app_label, Product._meta.model_name)))

# Path: cmsplugin_shop/models.py
# class Category(Node):
#     class Meta:
#         ordering            = ('tree_id', 'lft')
#         verbose_name        = _('category')
#         verbose_name_plural = _('categories')
# 
# class Product(Node):
#     date_added      = models.DateTimeField(_('date added'), auto_now_add=True)
#     last_modified   = models.DateTimeField(_('last modified'), auto_now=True)
#     multiple        = models.IntegerField(_('multiple'), default=1, null=False)
#     unit            = models.CharField(_('unit'), max_length=30, blank=True, null=True)
#     price           = PriceField(_('price'))
#     tax_rate        = TaxRateField(_('tax rate'))
#     related         = models.ManyToManyField('self', _('related products'), blank=True)
#     voucher_exclude = models.BooleanField(_('excluded from vouchers'), default=False)
# 
#     class Meta:
#         ordering            = ('tree_id', 'lft')
#         verbose_name        = _('product')
#         verbose_name_plural = _('products')
# 
#     @property
#     def unit_price(self):
#         return self.price / self.multiple
# 
#     def get_price(self):
#         return Price(self.price, self.tax_rate)
#     get_price.short_description = _('price')
# 
#     @cached_property
#     def all_packages(self):
#         return list(self.packages.all())


# Path: cmsplugin_shop/cms_toolbars.py
from cms.toolbar_base import CMSToolbar
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from .models import Category, Product

from __future__ import absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement



class ShopToolbar(CMSToolbar):
    def populate(self):
        admin_menu = self.toolbar.get_or_create_menu('shop_menu', _('Shop'))
        admin_menu.add_modal_item(_('Add product'), url=reverse('admin:{}_{}_add'.format(Product._meta.app_label, Product._meta.model_name)))

        admin_menu.add_modal_item(_('Add category'), url=reverse('admin:{}_{}_add'.format(Category._meta.app_label, Category._meta.model_name)))