From dfb6bb7de78d1221d38b9d5053157024a223279c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Wed, 23 Sep 2015 11:18:03 +0000 Subject: [PATCH] Save shop name if different --- amiibofindr/apps/amiibo/management/commands/fetch_price.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/amiibofindr/apps/amiibo/management/commands/fetch_price.py b/amiibofindr/apps/amiibo/management/commands/fetch_price.py index 8aba48e..7a41327 100644 --- a/amiibofindr/apps/amiibo/management/commands/fetch_price.py +++ b/amiibofindr/apps/amiibo/management/commands/fetch_price.py @@ -18,7 +18,9 @@ class Command(BaseCommand): item_id=product['shop_product_id'], shop__flag_code=region[0] ) - amiibo_shop.shop_name = product['title'] + if amiibo_shop.shop_name != product['title']: + amiibo_shop.shop_name = product['title'] + amiibo_shop.save() amiibo_shop.update_price(product['price'], product['currency']) def handle(self, *args, **kwargs): @@ -37,4 +39,4 @@ class Command(BaseCommand): for product in products: self.update_product(product, region) except TypeError: - self.update_product(product, region) + self.update_product(product, region) \ No newline at end of file