def get_properties(self):
        """
        Returns properties of the cart item. Resolves option names for select
        fields.
        """
        properties = []
        for prop_dict in self.product.get_properties():
            prop = prop_dict['property']
            property_group = prop_dict['property_group']
            price = ""

            try:
                cipv = CartItemPropertyValue.objects.get(cart_item=self,
                                                         property=prop,
                                                         property_group=property_group)
            except CartItemPropertyValue.DoesNotExist:
                continue

            if prop.is_select_field:
                try:
                    option = PropertyOption.objects.get(pk=int(float(cipv.value)))
                except (PropertyOption.DoesNotExist, __HOLE__):
                    value = cipv.value
                    price = 0.0
                else:
                    value = option.name
                    price = option.price

            elif prop.is_number_field:
                format_string = "%%.%sf" % prop.decimal_places
                try:
                    value = format_string % float(cipv.value)
                except ValueError:
                    value = locale.format("%.2f", float(cipv.value))
            else:
                value = cipv.value

            properties.append({
                "name": prop.name,
                "title": prop.title,
                "unit": prop.unit,
                "display_price": prop.display_price,
                "value": value,
                "price": price,
                "obj": prop,
                "property_group": property_group,
                "property_group_name": property_group.name
            })

        properties = sorted(properties, key=lambda x: '{0}-{1}'.format(x['property_group_name'], x['obj'].position))
        return properties
dataset/ETHPy150Open diefenbach/django-lfs/lfs/cart/models.py/CartItem.get_properties