Ivy-Backend/ivy/products/models.py

17 lines
527 B
Python
Raw Normal View History

2023-03-05 21:56:48 +08:00
from django.db import models
from django.utils.timezone import now
2023-03-07 15:32:05 +08:00
from simple_history.models import HistoricalRecords
2023-03-05 21:56:48 +08:00
# Create your models here.
class Product(models.Model):
name = models.CharField(max_length=20)
quantity = models.IntegerField(default=0)
date_added = models.DateTimeField(default=now, editable=False)
2023-03-07 22:20:34 +08:00
changed_by = models.ForeignKey(
'auth.user', null=True, on_delete=models.SET_NULL)
2023-03-07 15:32:05 +08:00
history = HistoricalRecords()
2023-03-05 21:56:48 +08:00
def __str__(self):
return self.name