2024-11-24 02:20:18 +08:00
|
|
|
from django.db import models
|
|
|
|
from django.utils.timezone import now
|
|
|
|
|
|
|
|
|
|
|
|
class DocumentRequestUnit(models.Model):
|
|
|
|
document_request = models.ForeignKey(
|
|
|
|
"document_requests.DocumentRequest", on_delete=models.CASCADE
|
|
|
|
)
|
2024-12-18 17:05:44 +08:00
|
|
|
document = models.ForeignKey(
|
|
|
|
"documents.Document", on_delete=models.CASCADE)
|
2024-11-24 02:20:18 +08:00
|
|
|
copies = models.IntegerField(default=1, null=False, blank=False)
|
|
|
|
|
|
|
|
|
|
|
|
class DocumentRequest(models.Model):
|
2024-12-18 17:05:44 +08:00
|
|
|
requester = models.ForeignKey(
|
|
|
|
"accounts.CustomUser", on_delete=models.CASCADE)
|
|
|
|
questionnaire = models.ForeignKey(
|
|
|
|
"questionnaires.Questionnaire", on_delete=models.SET_NULL, null=True, blank=True)
|
2024-11-24 02:20:18 +08:00
|
|
|
documents = models.ManyToManyField("document_requests.DocumentRequestUnit")
|
|
|
|
date_requested = models.DateTimeField(default=now, editable=False)
|
|
|
|
college = models.CharField(max_length=64, blank=False, null=False)
|
|
|
|
purpose = models.TextField(max_length=512, blank=False, null=False)
|
|
|
|
|
|
|
|
STATUS_CHOICES = (
|
|
|
|
("pending", "Pending"),
|
|
|
|
("approved", "Approved"),
|
|
|
|
("denied", "Denied"),
|
|
|
|
)
|
|
|
|
|
2025-01-08 13:38:39 +08:00
|
|
|
remarks = models.TextField(max_length=512, blank=True, null=True)
|
|
|
|
|
2024-12-18 17:05:44 +08:00
|
|
|
status = models.CharField(
|
|
|
|
max_length=32, choices=STATUS_CHOICES, default="pending")
|
2024-11-24 02:20:18 +08:00
|
|
|
|
2024-11-24 10:34:41 +08:00
|
|
|
TYPE_CHOICES = (
|
|
|
|
("softcopy", "Softcopy"),
|
|
|
|
("hardcopy", "Hardcopy"),
|
|
|
|
)
|
|
|
|
|
2024-12-18 17:05:44 +08:00
|
|
|
type = models.CharField(
|
|
|
|
max_length=16, choices=TYPE_CHOICES, default="softcopy")
|