class Product(models.Model):
recommended = models.ManyToManyField('self')
"recommended": [
2,
3,
1,
38,
39,
40,
],
<div class="catalog-item" ng-repeat="recommended in product.recommended">
<div class="item-img">
<a href=""><img src="{{recommended.picture.external_img_url}}" alt=""></a>
</div>
<a href="#" class="item-title">{{ recommended.title }}</a>
<div class="item-price">
<div class="price-old">{{ recommended.oldprice }}</div>
<b>{{ recommended.price }}</b>
</div>
</div>
</div>
class ProductSerializer(serializers.ModelSerializer):
picture = ImageSerializer(read_only=True)
vendor = VendorSerializer()
class Meta:
model = Product
fields = (
'name', 'external_url', 'category', 'description', 'price', 'old_price', 'discount', 'discount_percent',
'popularity', 'order', 'click_count', 'redirect_count', 'visible', 'colors', 'sizes', 'currencies',
'picture', 'country_of_origin', 'manufacturer_warranty', 'vendor','recommended','id')
depth = 2