sbt-idp/cope2n-api/fwd_api/models/SubscriptionRequestFile.py

21 lines
858 B
Python
Raw Normal View History

2023-11-30 11:19:06 +00:00
from django.db import models
from fwd_api.constant.common import FileCategory
from fwd_api.models import SubscriptionRequest
from fwd_api.models.fields.EncryptedCharField import EncryptedCharField
from django.utils import timezone
import uuid
class SubscriptionRequestFile(models.Model):
2023-12-14 03:54:03 +00:00
def gen_random_code():
return f"FIL{uuid.uuid4().hex}"
code = models.CharField(max_length=300, default=gen_random_code)
2023-11-30 11:19:06 +00:00
file_name = models.CharField(max_length=300, default=None)
file_path = EncryptedCharField(max_length=500, default=None)
file_category = models.CharField(max_length=200, default=FileCategory.Origin.value)
request = models.ForeignKey(SubscriptionRequest, related_name="files", on_delete=models.CASCADE)
created_at = models.DateTimeField(default=timezone.now)
updated_at = models.DateTimeField(auto_now=True)