diff --git a/templates/includes/card.html b/templates/includes/card.html index 3fcfaf0..d75f7f7 100644 --- a/templates/includes/card.html +++ b/templates/includes/card.html @@ -13,7 +13,7 @@
-

{{ item.brand }} {{ item.category }} {{ item.subject }} {{ item.name }}
+

{{ item.brand }} {{ item.category }} {{ item.subject }} {{ item.name }} {{ item.object }}
✏️редактировать

{% for size in item.sizes.values %} {{ size.tech_size }}  diff --git a/wb/models.py b/wb/models.py index d728a57..477fe01 100644 --- a/wb/models.py +++ b/wb/models.py @@ -34,6 +34,7 @@ class Product: category: str = "" brand: str = "" image: str = "" + object: str = "" days_on_site: str = "" has_been_updated: dict = field(default_factory=dict) diff --git a/wb/services/rest_client/standard_client.py b/wb/services/rest_client/standard_client.py index 0f31e10..95f74b2 100644 --- a/wb/services/rest_client/standard_client.py +++ b/wb/services/rest_client/standard_client.py @@ -133,7 +133,7 @@ def get_content(self): } } } - images = dict() + content = dict() total = 1000 # Any number above 1000 will do limit = 1000 while total >= limit: @@ -151,10 +151,12 @@ def get_content(self): cards = data["cards"] for card in cards: - images[card["nmID"]] = card["mediaFiles"][0] + content[card["nmID"]] = { + "image": card["mediaFiles"][0], + "object": card["object"] + } else: logger.info(response.text) break logger.info("Exit loop") - return images - + return content diff --git a/wb/services/warehouse.py b/wb/services/warehouse.py index fa06c74..08a0e18 100644 --- a/wb/services/warehouse.py +++ b/wb/services/warehouse.py @@ -206,5 +206,6 @@ def attach_images(standard_token, products: dict): images = client.get_content() for wb_id, product in products.items(): if wb_id in images: - product.image = images[wb_id] + product.image = images[wb_id]["image"] + product.object = images[wb_id]["object"] return products