Я питаюсь изменить данные из фронта и отправить его в сохранение на бд. Теперь как мне сохранить изменение в вазу.
Мой сериализатор
class ProductSerializer(serializers.HyperlinkedModelSerializer):
category_id = CategorySerializer()
county_id = CountriesSerializer()
addin_id = AddinSerializer()
nomenclatures_id = NomenclaterusSerializer()
class Meta:
model = Product
fields = ['name', 'marketplace_product_id', 'offer_id', 'old_price', 'imtId', 'price', 'short_description', 'long_description', 'category_id', 'county_id', 'addin_id', 'nomenclatures_id', 'createAt', 'timestamps', ]
class ProductImageSerializer(serializers.HyperlinkedModelSerializer):
product_id = ProductSerializer()
class Meta:
model = ProductImage
fields = ['product_id', 'url']
class MarketPlacesSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = MarketPlaces
fields = ['title',]
class ProductMarketplacesSerializer(serializers.HyperlinkedModelSerializer):
product_id = ProductSerializer()
marketplace_name = MarketPlacesSerializer()
class Meta:
model = ProductMarketplaces
fields = ['product_id', 'marketplace_name', 'value']
Мой Вид для отправки продукт на фронт
class ProductView(ObjectMultipleModelAPIView):
querylist = [
{
'queryset': ProductMarketplaces.objects.all(),
'serializer_class': ProductMarketplacesSerializer,
'label': 'product',
},
{
'queryset': ProductImage.objects.all(),
'serializer_class': ProductImageSerializer,
'label': 'images',
}
]
pagination_class = LimitPagination
То что я получаю из фронта
[
{
"product_id": {
"id": 1001,
"name": "Куртки",
"marketplace_product_id": "335149ec-bd3a-5543-a183-f4d14361d9b9",
"offer_id": "",
"old_price": 0.0,
"imtId": 14102290,
"price": 0.0,
"short_description": "",
"long_description": "",
"category_id": {
"market_category_id": 1,
"name": "Куртки",
"parent_category_id": {
"name": "Одежда",
"description": ""
}
},
"county_id": {
"id": 1,
"name": "Бангладеш"
},
"addin_id": {
"brand_id": {
"id": 2,
"brand": "RIFLE"
},
"gender_id": {
"gender": "Женский"
},
"name_id": {
"name": "Куртка"
},
"description": "",
"tnved": "6211331000",
"compound_id": {
"value": "нейлон",
"count": 25,
"units": "%"
},
"complact": "куртка",
"width_on": null,
"taking_things": null,
"model_shoes": null,
"fastener_type": null,
"material_texture": null,
"pockets_type": null
},
"nomenclatures_id": {
"nomenclature_marketplace_id": "b0a17efc-9829-47a4-8790-7585f284d023",
"nmid": 18994895,
"vendore_code": "RJ3163-77600-64X/col",
"variabls_id": {
"variations_market_id": "26453fb2-7518-43ca-b21c-80fa2a5b42db",
"chrid": 51046376,
"barcode": "[]",
"variations_addin_id": {
"size": "",
"growth_size": "",
"difference_price": "3236",
"waistband": null,
"length": null,
"russian_size": null
}
},
"nomenclature_addin": {
"collection": "Базовая коллекция",
"color": ""
}
},
"createAt": "2021-04-13T11:44:33.073367Z",
"timestamps": "2021-04-13T11:44:33.073464Z"
},
"marketplace_name": {
"title": "Wildberries"
},
"value": "335149ec-bd3a-5543-a183-f4d14361d9b9"
}]