mirror of
https://github.com/lemeow125/Ivy-Backend.git
synced 2024-11-17 06:39:26 +08:00
16 lines
527 B
Python
16 lines
527 B
Python
from django.db import models
|
|
from django.utils.timezone import now
|
|
from simple_history.models import HistoricalRecords
|
|
# 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)
|
|
changed_by = models.ForeignKey(
|
|
'auth.user', null=True, on_delete=models.SET_NULL)
|
|
history = HistoricalRecords()
|
|
|
|
def __str__(self):
|
|
return self.name
|