You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
643 B
15 lines
643 B
from django.db import models
|
|
import uuid
|
|
from . import CustomUser
|
|
|
|
class Purchase(models.Model):
|
|
id = models.BigIntegerField(primary_key=True, unique=True, editable=True)
|
|
user = models.ForeignKey(CustomUser, on_delete=models.CASCADE)
|
|
purchase_date = models.DateTimeField()
|
|
product_id = models.CharField(max_length=100)
|
|
quantity = models.IntegerField(null=True, blank=True)
|
|
revocation_date = models.DateTimeField(null=True, blank=True)
|
|
expiration_date = models.DateTimeField(null=True, blank=True)
|
|
|
|
def __str__(self):
|
|
return f"{self.id} > {self.product_id} - {self.purchase_date} - {self.user.username}"
|
|
|