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 {}
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 {}