from django.db import models
from shop.models import Shop, Image

class Product(models.Model):
    name = models.CharField(max_length=100, unique=True)
    description = models.CharField(max_length=255)
    price = models.FloatField()
    shop = models.ForeignKey(Shop, related_name="products", on_delete=models.CASCADE)
    rating = models.FloatField()
    available = models.BooleanField(default=True)
    image = models.ForeignKey(Image, related_name='product_images', on_delete=models.CASCADE, null=True)
    related_images = models.ManyToManyField(Image, related_name="detailed_images", blank=True)


    def __str__(self):
        return self.name
fc4ccb2288eaef71c2b37310a642c41a94b16229
<mask token>


class Product(models.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

<mask token>


class Product(models.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

    def __str__(self):
        return self.name

<mask token>


class Product(models.Model):
    name = models.CharField(max_length=100, unique=True)
    description = models.CharField(max_length=255)
    price = models.FloatField()
    shop = models.ForeignKey(Shop, related_name='products', on_delete=
        models.CASCADE)
    rating = models.FloatField()
    available = models.BooleanField(default=True)
    image = models.ForeignKey(Image, related_name='product_images',
        on_delete=models.CASCADE, null=True)
    related_images = models.ManyToManyField(Image, related_name=
        'detailed_images', blank=True)

    def __str__(self):
        return self.name

from django.db import models
from shop.models import Shop, Image


class Product(models.Model):
    name = models.CharField(max_length=100, unique=True)
    description = models.CharField(max_length=255)
    price = models.FloatField()
    shop = models.ForeignKey(Shop, related_name='products', on_delete=
        models.CASCADE)
    rating = models.FloatField()
    available = models.BooleanField(default=True)
    image = models.ForeignKey(Image, related_name='product_images',
        on_delete=models.CASCADE, null=True)
    related_images = models.ManyToManyField(Image, related_name=
        'detailed_images', blank=True)

    def __str__(self):
        return self.name

from django.db import models
from shop.models import Shop, Image

class Product(models.Model):
    name = models.CharField(max_length=100, unique=True)
    description = models.CharField(max_length=255)
    price = models.FloatField()
    shop = models.ForeignKey(Shop, related_name="products", on_delete=models.CASCADE)
    rating = models.FloatField()
    available = models.BooleanField(default=True)
    image = models.ForeignKey(Image, related_name='product_images', on_delete=models.CASCADE, null=True)
    related_images = models.ManyToManyField(Image, related_name="detailed_images", blank=True)


    def __str__(self):
        return self.name