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.
28 lines
1.0 KiB
28 lines
1.0 KiB
from django.db import models
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
from filer.fields.file import FilerFileField
|
|
from apps.course.models import Course
|
|
from apps.account.models import StudentUser
|
|
|
|
|
|
|
|
class Certificate(models.Model):
|
|
STATUS_CHOICES = [
|
|
('pending', _('pending')),
|
|
('approved', _('approved')),
|
|
('canceled', _('canceled')),
|
|
]
|
|
|
|
student = models.ForeignKey(StudentUser, on_delete=models.CASCADE, related_name='certificates')
|
|
course = models.ForeignKey(Course, on_delete=models.CASCADE, related_name='course_certificates')
|
|
status = models.CharField(max_length=10, choices=STATUS_CHOICES, default='pending')
|
|
certificate_file = models.FileField(upload_to='certificates/', null=True, blank=True, verbose_name=_('certificate_file'))
|
|
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
|
|
def __str__(self):
|
|
return f"Certificate {self.student.fullname} - {self.course.title}"
|
|
|
|
|