Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Zenobius Jiricek committed Jan 23, 2012
1 parent 44c2109 commit 95caa90
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
7 changes: 4 additions & 3 deletions cmsplugin_configurableproduct/cms_plugins.py
Expand Up @@ -37,14 +37,15 @@ def render(self, context, instance, placeholder):

types = ProductType.objects.all()

chosen_categories = instance.categories.all()
if chosen_categories :
types = chosen_categories

if instance.hide_empty_categories :
objects = Product.objects.filter(active=True)
used_types = objects.values("type").distinct()
types = types.filter(pk__in = used_types)

# chosen_categories = instance.categories.all()
# if chosen_categories.count() > 0:
# types.filter(pk__in = instance.categories.values('id'))

context.update({
'Types': types,
Expand Down
8 changes: 4 additions & 4 deletions cmsplugin_configurableproduct/models.py
Expand Up @@ -12,8 +12,7 @@

from .lib.choices import (
DynamicTemplateChoices,
DynamicChoice,
)
DynamicChoice, )

STATIC_URL = getattr(settings, "STATIC_URL", '/static')
STATIC_ROOT = getattr(settings, "STATIC_ROOT", None)
Expand All @@ -30,12 +29,13 @@ class ApplicationSettings(AppConf):
PRODUCT_CONTAINER_TEMPLATES = os.path.join(TEMPLATE_BASE_PATH, "product-list", 'containers')
PRODUCT_ITEM_TEMPLATES = os.path.join(TEMPLATE_BASE_PATH, "product-list", 'items')

DEFAULT_CATEGORY_IMAGE_URL = '{0}/defaults/img/product-category'.format(STATIC_URL)
DEFAULT_CATEGORY_IMAGE_ROOT = '{0}/defaults/img/product-category'.format(STATIC_ROOT)
DEFAULT_CATEGORY_IMAGE_URL = os.path.join(STATIC_URL, 'defaults', 'img',
'product-category', 'missing-icon-{0}.png')

CATEGORY_IMAGE_URL = '{0}/product-category'.format(MEDIA_URL)
CATEGORY_IMAGE_ROOT = '{0}/product-category'.format(MEDIA_ROOT)


class ProductTypeIcon(models.Model):
upload_path = lambda instance, filename: "files/product-category/{0}".format(
"{0}-{1}".format(slugify(instance.product_type), filename) )
Expand Down
Expand Up @@ -35,7 +35,6 @@ def render_tag(self, context, product_type, tag):
try:
icon= product_type.icons.get(name = tag)
return settings.MEDIA_URL+str(icon.image)
# return "/".join((ApplicationSettings.CATEGORY_IMAGE_URL, icon.image))

except Exception, error:
return ApplicationSettings.DEFAULT_CATEGORY_IMAGE_URL
return ApplicationSettings.DEFAULT_CATEGORY_IMAGE_URL.format(tag.lower())

0 comments on commit 95caa90

Please sign in to comment.