Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Product(models.Model):
- category = models.ForeignKey(Category, on_delete=models.CASCADE, related_name='products')
- name = models.CharField(max_length=200, db_index=True)
- slug = models.SlugField(max_length=200, db_index=True)
- image = models.ImageField(upload_to='products/%Y/%m/%d/', blank=True)
- descriptions = models.TextField(blank=True)
- price = models.DecimalField(max_digits=10, decimal_places=2)
- available = models.BooleanField(default=True)
- created = models.DateTimeField(auto_now_add=True)
- updated = models.DateTimeField(auto_now=True)
- class Meta:
- ordering = ['name']
- index_together = [['id', 'slug'],]
Advertisement
Add Comment
Please, Sign In to add comment