Exemplo n.º 1
0
    def get_localized_prices(self, obj):
        region = self.context['request'].REGION

        for price in self.get_prices(obj):
            if price['region'] == region.id:
                result = price.copy()
                result.update({
                    'locale': price_locale(price['price'], price['currency']),
                    'region': region.name,
                })
                return result
        return {}
Exemplo n.º 2
0
    def dehydrate_localized(self, bundle):
        region = bundle.request.REGION

        for price in self._get_prices(bundle):
            if price['region'] == region.id:
                result = price.copy()
                result.update({
                    'locale': price_locale(price['price'], price['currency']),
                    'region': region.name,
                })
                return result

        return {}
Exemplo n.º 3
0
    def get_localized_prices(self, obj):
        region = self.context['request'].REGION

        for price in self.get_prices(obj):
            if price['region'] == region.id:
                result = price.copy()
                result.update({
                    'locale':
                    price_locale(price['price'], price['currency']),
                    'region':
                    region.name,
                })
                return result
        return {}
Exemplo n.º 4
0
    def dehydrate_localized(self, bundle):
        region = bundle.request.REGION

        for price in self._get_prices(bundle):
            if price['region'] == region.id:
                result = price.copy()
                result.update({
                    'locale':
                    price_locale(price['price'], price['currency']),
                    'region':
                    region.name,
                })
                return result

        return {}