Skip to content

Commit

Permalink
Merged 0.7 branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
diefenbach committed Apr 8, 2012
2 parents 1b78749 + 893ae01 commit d8c9a25
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 54 deletions.
1 change: 1 addition & 0 deletions .hgtags
Expand Up @@ -88,3 +88,4 @@ a83ce68b7ddcc44695c16abb07e34e2b5b26f0d1 0.6.12
0000000000000000000000000000000000000000 0.7.0b6
0000000000000000000000000000000000000000 0.7.0b6
4c5deef31192ac064cd1d9bee5203ef82ca61b23 0.7.0b6
bb2d226a4f695093866b2ada1ecf213474db4996 0.7.0b7
11 changes: 11 additions & 0 deletions README.txt
Expand Up @@ -32,6 +32,17 @@ Unreleased

New: added view to display environment

0.7.0 beta 7 (2012-04-08)
-------------------------

* Bugfix: display ``displayed properties`` in the correct order py positions; issue #184
* Bugfix: display property options in the correct order by positions within filter portlet
* Bugfix: fixed image presentation directly after upload within shop management interface (Maciej Wiśniowski)
* Bugfix: fixed display of discounts
* New: added variants tab to documentation
* Updated Polish translations (Maciej Wiśniowski)
* Updated German translations

0.7.0 beta 6 (2012-03-31)
-------------------------

Expand Down
7 changes: 6 additions & 1 deletion lfs/catalog/models.py
Expand Up @@ -1017,23 +1017,28 @@ def get_displayed_properties(self):
return properties

properties = []
for ppv in self.property_values.filter(property__display_on_product=True, type=PROPERTY_VALUE_TYPE_DISPLAY).order_by("property__position"):
for ppv in self.property_values.filter(property__display_on_product=True, type=PROPERTY_VALUE_TYPE_DISPLAY):
if ppv.property.is_select_field:
try:
po = PropertyOption.objects.get(pk=int(float(ppv.value)))
except (PropertyOption.DoesNotExist, ValueError):
continue
else:
value = po.name
position = po.position
else:
value = ppv.value
position = 1

properties.append({
"name": ppv.property.name,
"title": ppv.property.title,
"value": value,
"position": (ppv.property.position * 1000) + position,
"unit": ppv.property.unit,
})

properties.sort(lambda a, b: cmp(a["position"], b["position"]))
cache.set(cache_key, properties)
return properties

Expand Down
4 changes: 2 additions & 2 deletions lfs/catalog/tests.py
Expand Up @@ -1560,12 +1560,12 @@ def setUp(self):
self.p3 = Product.objects.create(name=u"Product 3", slug=u"product-3", active=True)

# Create a size property with two options
self.size = size = Property.objects.create(name="Size", type=PROPERTY_SELECT_FIELD)
self.size = size = Property.objects.create(name="Size", type=PROPERTY_SELECT_FIELD, position=10)
self.l = l = PropertyOption.objects.create(name="L", property=size)
self.m = m = PropertyOption.objects.create(name="M", property=size)

# Create a color property with two options
self.color = color = Property.objects.create(name="Color", type=PROPERTY_SELECT_FIELD)
self.color = color = Property.objects.create(name="Color", type=PROPERTY_SELECT_FIELD, position=20)
self.red = red = PropertyOption.objects.create(name="Red", property=color)
self.green = green = PropertyOption.objects.create(name="Green", property=color)

Expand Down
6 changes: 5 additions & 1 deletion lfs/catalog/utils.py
Expand Up @@ -320,9 +320,11 @@ def get_product_filters(category, product_filter, price_filter, sorting):

# If the property is a select field we want to display the name of the
# option instead of the id.
position = 1
if property.is_select_field:
try:
name = options_mapping[row[1]].name
position = options_mapping[row[1]].position
except KeyError:
name = row[1]
elif property.is_number_field:
Expand All @@ -343,6 +345,7 @@ def get_product_filters(category, product_filter, price_filter, sorting):
"id": row[0],
"value": value,
"name": name,
"position": position,
"quantity": amount[row[0]][row[1]],
"show_quantity": False,
}]
Expand All @@ -354,6 +357,7 @@ def get_product_filters(category, product_filter, price_filter, sorting):
"id": row[0],
"value": value,
"name": name,
"position": position,
"quantity": amount[row[0]][row[1]],
"show_quantity": True,
})
Expand All @@ -368,7 +372,7 @@ def get_product_filters(category, product_filter, price_filter, sorting):
# Sort the values. NOTE: This has to be done here (and not via SQL) as
# the value field of the property is a char field and can't ordered
# properly for numbers.
values.sort(lambda a, b: cmp(a["value"], b["value"]))
values.sort(lambda a, b: cmp(a["position"], b["position"]))

result.append({
"id": property_id,
Expand Down
Binary file modified lfs/locale/de/LC_MESSAGES/django.mo
Binary file not shown.

0 comments on commit d8c9a25

Please sign in to comment.