mirror of
https://github.com/lemeow125/Ivy-Backend.git
synced 2024-11-17 06:39:26 +08:00
Added history field to product model
This commit is contained in:
parent
ad866ca05f
commit
2ea9d7a1de
1 changed files with 2 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
|
from simple_history.models import HistoricalRecords
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +8,7 @@ class Product(models.Model):
|
||||||
name = models.CharField(max_length=20)
|
name = models.CharField(max_length=20)
|
||||||
quantity = models.IntegerField(default=0)
|
quantity = models.IntegerField(default=0)
|
||||||
date_added = models.DateTimeField(default=now, editable=False)
|
date_added = models.DateTimeField(default=now, editable=False)
|
||||||
|
history = HistoricalRecords()
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
Loading…
Reference in a new issue