예제 #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 {}
예제 #2
0
파일: resources.py 프로젝트: at13/zamboni
    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 {}
예제 #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 {}
예제 #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 {}