Guest User

Untitled

a guest
Sep 1st, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. class Product(models.Model):
  2.     category = models.ForeignKey(Category, on_delete=models.CASCADE, related_name='products')
  3.     name = models.CharField(max_length=200, db_index=True)
  4.     slug = models.SlugField(max_length=200, db_index=True)
  5.     image = models.ImageField(upload_to='products/%Y/%m/%d/', blank=True)
  6.     descriptions = models.TextField(blank=True)
  7.     price = models.DecimalField(max_digits=10, decimal_places=2)
  8.     available = models.BooleanField(default=True)
  9.     created = models.DateTimeField(auto_now_add=True)
  10.     updated = models.DateTimeField(auto_now=True)
  11.  
  12.     class Meta:
  13.         ordering = ['name']
  14.         index_together = [['id', 'slug'],]
Advertisement
Add Comment
Please, Sign In to add comment