28 lines
925 B
Python

from django.db import models
class Product(models.Model):
name = models.CharField(max_length=255)
description = models.TextField()
price = models.DecimalField(max_digits=10, decimal_places=2)
imagen = models.ImageField(
upload_to='product',
verbose_name='imagen',
max_length=355,
blank=True,
null=True
)
created_at = models.DateTimeField('created at', auto_now_add=True,
help_text='Date time on which the object was created.')
modified_at = models.DateTimeField('modified at', auto_now=True,
help_text='Date time on which the object was last modified.')
is_active = models.BooleanField(default=True)
def __str__(self):
return self.name
class Meta:
verbose_name = 'Producto'
verbose_name_plural = 'Productos'
ordering = ['name']