feat: add new document and documentcategory model for auto evaluation detail
This commit is contained in:
@@ -3,9 +3,10 @@ from django.utils.translation import gettext_lazy as _
|
||||
from django_core.models import AbstractBaseModel
|
||||
from model_bakery import baker
|
||||
|
||||
from .valuation import ValuationModel
|
||||
from core.apps.evaluation.choices.document import DocumentType
|
||||
|
||||
from .valuation import ValuationModel
|
||||
|
||||
|
||||
class ValuationDocumentModel(AbstractBaseModel):
|
||||
valuation = models.ForeignKey(
|
||||
@@ -54,3 +55,35 @@ class ValuationDocumentModel(AbstractBaseModel):
|
||||
verbose_name = _("Valuation Document")
|
||||
verbose_name_plural = _("Valuation Documents")
|
||||
ordering = ["-created_at"]
|
||||
|
||||
|
||||
class DocumentModel(AbstractBaseModel):
|
||||
auto_evaluation = models.ForeignKey(
|
||||
"evaluation.AutoEvaluationModel",
|
||||
on_delete=models.CASCADE,
|
||||
related_name="documents",
|
||||
verbose_name=_("auto evaluation"),
|
||||
)
|
||||
title = models.CharField(verbose_name=_("title"), max_length=255)
|
||||
document = models.FileField(
|
||||
verbose_name=_("document"),
|
||||
upload_to="evaluation/documents/%Y/%m/",
|
||||
)
|
||||
category = models.ForeignKey(
|
||||
"evaluation.DocumentCategoryModel",
|
||||
on_delete=models.CASCADE,
|
||||
related_name="documents",
|
||||
verbose_name=_("category"),
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.pk)
|
||||
|
||||
@classmethod
|
||||
def _baker(cls):
|
||||
return baker.make(cls)
|
||||
|
||||
class Meta:
|
||||
db_table = "Document"
|
||||
verbose_name = _("DocumentModel")
|
||||
verbose_name_plural = _("DocumentModels")
|
||||
|
||||
Reference in New Issue
Block a user