Дело в том что у меня разный связь.
.models
class MarketPlaces(models.Model):
title = models.CharField(max_length=80)
system_name = models.CharField(max_length=50)
url = models.CharField(max_length=100, blank=True)
credentials = models.TextField(max_length=200)
class Meta:
verbose_name = 'Площадка торговлии'
verbose_name_plural = 'Площадка торговлия'
class VariationsAddin(models.Model):
size = models.CharField(max_length=10, blank=True)
growth_size = models.CharField(max_length=10, blank=True)
difference_price = models.CharField(max_length=10, blank=True, null=True)
waistband = models.CharField(max_length=50, blank=True, null=True)
length = models.CharField(max_length=50, blank=True, null=True)
russian_size = models.CharField(max_length=20, blank=True, null=True)
class Meta:
verbose_name = 'Цена и размер'
verbose_name_plural = 'Цена размеры'
class NomenclaterusVariations(models.Model):
variations_market_id = models.CharField(max_length=50, null=True, blank=True)
chrid = models.IntegerField(default=True)
barcode = models.CharField(max_length=100, blank=True, null=True)
variations_addin_id = models.ForeignKey(VariationsAddin, on_delete=models.CASCADE, blank=True, null=True)
class Meta:
verbose_name = 'Вариант номенклатури'
verbose_name_plural = 'Варианты номенклатуры'
class NomenclatureAddin(models.Model):
collection = models.CharField(max_length=100, blank=True)
color = models.CharField(max_length=100, blank=True)
class Nomenclaterus(models.Model):
nomenclature_marketplace_id = models.CharField(max_length=50, blank=True)
nmid = models.IntegerField(default=True)
vendore_code = models.CharField(max_length=50, blank=True)
variabls_id = models.ForeignKey(NomenclaterusVariations, on_delete=models.CASCADE)
nomenclature_addin = models.ForeignKey(NomenclatureAddin, on_delete=models.CASCADE, null=True, blank=True)
class Meta:
verbose_name = 'Номенклатури'
verbose_name_plural = 'Номенклатуры'
class Product(models.Model):
name = models.CharField(max_length=200, blank=True)
marketplace_product_id = models.CharField(max_length=50, default=0)
offer_id = models.CharField(max_length=50, blank=True)
old_price = models.FloatField(default=0)
imtId = models.IntegerField(default=0)
price = models.FloatField(default=0)
short_description = models.CharField(max_length=200, blank=True)
long_description = models.TextField(blank=True)
category_id = models.ForeignKey(Category, on_delete=models.CASCADE, null=True, blank=True)
county_id = models.ForeignKey(Countries, on_delete=models.CASCADE, null=True, blank=True)
addin_id = models.ForeignKey(Addin, on_delete=models.CASCADE, null=True, blank=True)
nomenclatures_id = models.ForeignKey(Nomenclaterus, on_delete=models.CASCADE, null=True, blank=True)
createAt = models.DateTimeField(auto_now_add=True, blank=True)
timestamps = models.DateTimeField(auto_now_add=True, blank=True)
def __str__(self):
return f'#{self.name}'
class Meta:
verbose_name = 'Продукт'
verbose_name_plural = 'Продукты'
class ProductImage(models.Model):
product_id = models.ForeignKey(Product, on_delete=models.CASCADE)
url = models.CharField(max_length=200)
class Meta:
verbose_name = 'Фотография'
verbose_name_plural = 'Фотографии'
class Attribute(models.Model):
label = models.TextField(blank=True)
typeEnum = models.CharField(max_length=100, blank=True)
values = models.IntegerField(default=0)
default_value = models.IntegerField(default=0)
placeholder = models.CharField(max_length=100, blank=True)
def __str__(self):
return f'#{self.label}'
class Meta:
verbose_name = 'Аттрибут'
verbose_name_plural = 'Аттрибуты'
class ProductMarketplaces(models.Model):
product_id = models.ForeignKey(Product, on_delete=models.CASCADE)
marketplace_name = models.ForeignKey(MarketPlaces, on_delete=models.CASCADE)
value = models.CharField(max_length=200, blank=True, null=True)
из за того что это очень большие данные то как мне вместо id отправить значение через сериализаторов?
или так сказать в один url адресс вывести полно описание товаров.