Permalink
Browse files

moved template directory around

  • Loading branch information...
1 parent 455e240 commit 2a1e1f503f8461b80c933e2191d2b56d2885f4eb Zenobius Jiricek committed Dec 27, 2011
@@ -0,0 +1 @@
+version = '0.0.2'
@@ -10,29 +10,31 @@
from .models import (
CProductTypesPlugin,
CProductsPlugin,
+ PRODUCT_TYPE_TEMPLATE_PATH,
+ PRODUCT_LIST_TEMPLATE_PATH,
)
class ProductCategories(CMSPluginBase):
model = CProductTypesPlugin
- name = _("Product Types")
- render_template = "shop/plugins/configurable_product/product-types/base.html"
+ name = _("List of Product Types")
+ render_template = os.path.join(PRODUCT_TYPE_TEMPLATE_PATH, "base.html")
def render(self, context, instance, placeholder):
objects = Product.objects.filter(active=True)
used_types = objects.values("type").distinct()
types = ProductType.objects.filter(pk__in = used_types)
context.update({'Types': types, })
return context
+
plugin_pool.register_plugin(ProductCategories)
class CategoryProducts(CMSPluginBase):
model = CProductsPlugin
- name = _("Products of Type")
- render_template = "shop/plugins/configurable_product/product-list/base.html"
+ name = _("List of Products")
+ render_template = os.path.join(PRODUCT_LIST_TEMPLATE_PATH, "base.html")
def render(self, context, instance, placeholder):
-
products = Product.objects.filter(type__pk__in = instance.categories.all())
context.update({
"Products": products
@@ -60,15 +60,15 @@ def walkdir(self, path=None):
return output
+PRODUCT_TYPE_TEMPLATE_PATH = os.path.join("cmsplugin_configurable_product", "product-types")
+PRODUCT_LIST_TEMPLATE_PATH = os.path.join("cmsplugin_configurable_product", "product-list")
class CProductTypesPlugin(CMSPlugin):
""" Stores options for cmsplugin that shows lists of ProductTypes
"""
- TEMPLATE_PATH = os.path.join("shop", "plugins",
- "configurable_product", "product-types")
TEMPLATE_CHOICES = DynamicTemplateChoices(
- path=TEMPLATE_PATH,
+ path=PRODUCT_TYPE_TEMPLATE_PATH,
include='.html',
exclude='base')
@@ -86,7 +86,7 @@ class CProductTypesPlugin(CMSPlugin):
template = models.CharField(choices=TEMPLATE_CHOICES,
max_length=256, blank=True, null=True,
help_text="""Select a template to render this
- list. Templates are stored in : {0}""".format(TEMPLATE_PATH))
+ list. Templates are stored in : {0}""".format(PRODUCT_TYPE_TEMPLATE_PATH))
def __unicode__(self):
return U"Types: {0}".format(self.categories.all())
@@ -99,10 +99,8 @@ class CProductsPlugin(CMSPlugin):
("show", "Filter"),
("hide", "Exclude")
)
- TEMPLATE_PATH = os.path.join("shop", "plugins",
- "configurable_product", "product-list")
TEMPLATE_CHOICES = DynamicTemplateChoices(
- path=TEMPLATE_PATH,
+ path=PRODUCT_LIST_TEMPLATE_PATH,
include='.html',
exclude='base')
@@ -125,14 +123,7 @@ class CProductsPlugin(CMSPlugin):
template = models.CharField(choices=TEMPLATE_CHOICES,
max_length=256,
blank=True, null=True, help_text="""Select a template to render this
- list. Templates are stored in : {0}""".format(TEMPLATE_PATH))
-
- def get_template_choices(self):
- choices = list()
- for template_dir in app_template_dirs:
- choices += walkdir(os.path.join(template_dir,self.TEMPLATE_PATH),
- ".html", "base")
- return choices
+ list. Templates are stored in : {0}""".format(PRODUCT_LIST_TEMPLATE_PATH))
def __unicode__(self):
return U"Types: {0}".format(",".join([ ctype.name for ctype in self.categories.all()]))
View
@@ -1,17 +1,18 @@
import os
-
from setuptools import (
setup,
find_packages,
)
+import cmsplugin_configurableproduct
+
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='djangocms-plugin-configurableproduct',
- version='0.0.1',
- classifiers = [
+ version=cmsplugin_configurableproduct.__version__,
+ classifiers = [
'Development Status :: 4 - Beta',
'Framework :: Django',
'Intended Audience :: Developers',
@@ -22,16 +23,16 @@ def read(fname):
],
packages=find_packages(),
install_requires=[
- 'sorl-thumbnail',
'django-shop',
+ 'django-cms'
],
- author='Pavel Zhukov',
+ author='Zenobius Jiricek',
author_email='airtonix@gmail.com',
- description='DjangoCMS plugin for Configurable product for django-shop',
+ description='DjangoCMS plugin for django-shop-configurableproduct',
long_description = read('README.md'),
license='BSD',
- keywords='djangocms, django-shop, product',
- url='git://github.com/airtonix/djangocms-plugin-configurableproduct.git',
+ keywords='django-cms, django-shop, product',
+ url='http://github.com/airtonix/djangocms-plugin-configurableproduct',
include_package_data=True,
zip_safe = False,
)

0 comments on commit 2a1e1f5

Please sign in to comment.