Added history field to product model

This commit is contained in:
keannu125 2023-03-07 15:32:05 +08:00
parent ad866ca05f
commit 2ea9d7a1de

View file

@ -1,5 +1,6 @@
from django.db import models
from django.utils.timezone import now
from simple_history.models import HistoricalRecords
# Create your models here.
@ -7,6 +8,7 @@ class Product(models.Model):
name = models.CharField(max_length=20)
quantity = models.IntegerField(default=0)
date_added = models.DateTimeField(default=now, editable=False)
history = HistoricalRecords()
def __str__(self):
return self.name