-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: backend attachments with form data
- Loading branch information
Showing
13 changed files
with
208 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from django.db import models | ||
from django.db.models import Q, CharField, FileField, ForeignKey | ||
from registration.models.time_stamped_model import TimeStampedModel | ||
from reporting.models.report_version import ReportVersion | ||
|
||
FOLDER_NAME = 'report_attachments/%Y/' | ||
|
||
|
||
class ReportAttachment(TimeStampedModel): | ||
|
||
class ReportAttachmentType(models.TextChoices): | ||
verification_statement = "verification_statement" | ||
wci_352_362 = "wci_352_362" | ||
additional_reportable_information = "additional_reportable_information" | ||
confidentiality_request = "confidentiality_request" | ||
|
||
report_version = ForeignKey( | ||
ReportVersion, | ||
on_delete=models.CASCADE, | ||
related_name="report_attachments", | ||
db_comment="The report version this attachment belongs to", | ||
) | ||
attachment = FileField(upload_to=FOLDER_NAME, db_comment="A file uploaded as an attachment to a report") | ||
attachment_type = CharField( | ||
max_length=1000, | ||
choices=ReportAttachmentType.choices, | ||
db_comment="The type of attachment this record represents", | ||
) | ||
|
||
class Meta: | ||
db_table_comment = "Table containing the file information for the report attachments" | ||
db_table = 'erc"."report_attachment' | ||
app_label = "reporting" | ||
constraints = [ | ||
# Check that only one attachment type is present, except if the attachment type is 'other' | ||
models.UniqueConstraint( | ||
name="unique_attachment_type_per_report_version", | ||
fields=['report_version', 'attachment_type'], | ||
) | ||
] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from ninja import Schema | ||
from reporting.models.report_attachment import ReportAttachment | ||
|
||
|
||
class ReportAttachmentOut(Schema): | ||
|
||
class Meta: | ||
model = ReportAttachment | ||
fields = ['id', 'attachment', 'attachment_type'] |
This file was deleted.
Oops, something went wrong.
Binary file added
BIN
+45.7 KB
bc_obps/test_media/report_attachments/2024/OBPS_application_architecture.pdf
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.