# Path: cmsplugin_shop/models.py
# class ProductPlugin(CMSPlugin):
#     product     = models.ForeignKey(Product, verbose_name=_('product'))
#     template    = models.CharField(_('template'), max_length=100, choices=settings.PRODUCT_TEMPLATES,
#                                 default=settings.PRODUCT_TEMPLATES[0][0],
#                                 help_text=_('the template used to render plugin'))
# 
#     def __str__(self):
#         return self.product.name
# 
#     @cached_property
#     def render_template(self):
#         return 'cmsplugin_shop/product/%s.html' % self.template
# 
# class CategoryPlugin(CMSPlugin):
#     category    = models.ForeignKey(Category, verbose_name=_('category'))
#     template    = models.CharField(_('template'), max_length=100, choices=settings.CATEGORY_TEMPLATES,
#                                 default=settings.CATEGORY_TEMPLATES[0][0],
#                                 help_text=_('the template used to render plugin'))
# 
#     def __str__(self):
#         return self.category.name
# 
#     @cached_property
#     def render_template(self):
#         return 'cmsplugin_shop/category/%s.html' % self.template


from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext as _
from .models import ProductPlugin, CategoryPlugin
from __future__ import absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement





class ProductPlugin(CMSPluginBase):
    model = ProductPlugin
    name = _('Product')
    text_enabled = True

    def render(self, context, instance, placeholder):
        context.update({
            'plugin': instance,
            'product': instance.product,
            'placeholder': placeholder,
        })
        return context




# Path: cmsplugin_shop/models.py
# class ProductPlugin(CMSPlugin):
#     product     = models.ForeignKey(Product, verbose_name=_('product'))
#     template    = models.CharField(_('template'), max_length=100, choices=settings.PRODUCT_TEMPLATES,
#                                 default=settings.PRODUCT_TEMPLATES[0][0],
#                                 help_text=_('the template used to render plugin'))
# 
#     def __str__(self):
#         return self.product.name
# 
#     @cached_property
#     def render_template(self):
#         return 'cmsplugin_shop/product/%s.html' % self.template
# 
# class CategoryPlugin(CMSPlugin):
#     category    = models.ForeignKey(Category, verbose_name=_('category'))
#     template    = models.CharField(_('template'), max_length=100, choices=settings.CATEGORY_TEMPLATES,
#                                 default=settings.CATEGORY_TEMPLATES[0][0],
#                                 help_text=_('the template used to render plugin'))
# 
#     def __str__(self):
#         return self.category.name
# 
#     @cached_property
#     def render_template(self):
#         return 'cmsplugin_shop/category/%s.html' % self.template


# Path: cmsplugin_shop/plugins.py
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext as _
from .models import ProductPlugin, CategoryPlugin

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





class ProductPlugin(CMSPluginBase):
    model = ProductPlugin
    name = _('Product')
    text_enabled = True

    def render(self, context, instance, placeholder):
        context.update({
            'plugin': instance,
            'product': instance.product,
            'placeholder': placeholder,
        })
        return context




class CategoryPlugin(CMSPluginBase):