aboutsummaryrefslogtreecommitdiff
path: root/saleor/graphql
diff options
context:
space:
mode:
authorMarcin Gębala <maarcin.gebala@gmail.com>2017-01-31 16:46:28 +0100
committerMarcin Gębala <maarcin.gebala@gmail.com>2017-01-31 16:46:28 +0100
commite59e090258ccd1c9be17d486479c59a310d9fdcd (patch)
tree38c15551561cf724ceb6c3afbe47d08e6c2e7190 /saleor/graphql
parentea8aadb0174a4347423a3eff296c0a89b33fbe3f (diff)
downloadsaleor-frontend-e59e090258ccd1c9be17d486479c59a310d9fdcd.tar.gz
saleor-frontend-e59e090258ccd1c9be17d486479c59a310d9fdcd.tar.bz2
saleor-frontend-e59e090258ccd1c9be17d486479c59a310d9fdcd.zip
Localize prices in React components
Diffstat (limited to 'saleor/graphql')
-rw-r--r--saleor/graphql/api.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/saleor/graphql/api.py b/saleor/graphql/api.py
index 3b674340..28c71016 100644
--- a/saleor/graphql/api.py
+++ b/saleor/graphql/api.py
@@ -6,6 +6,7 @@ from django.db.models import Q
from graphene import relay
from graphene_django import DjangoObjectType, DjangoConnectionField
from graphene_django.debug import DjangoDebug
+from django_prices.templatetags import prices_i18n
from ..product.models import (AttributeChoiceValue, Category, Product,
ProductAttribute, ProductImage, ProductVariant)
@@ -210,9 +211,17 @@ class ProductAttributeType(DjangoObjectType):
class PriceType(graphene.ObjectType):
+ currency = graphene.String()
gross = graphene.Float()
+ gross_localized = graphene.String()
net = graphene.Float()
- currency = graphene.String()
+ net_localized = graphene.String()
+
+ def resolve_gross_localized(self, args, context, info):
+ return prices_i18n.gross(self)
+
+ def resolve_net_localized(self, args, context, info):
+ return prices_i18n.net(self)
class PriceRangeType(graphene.ObjectType):