Skip to content

Commit

Permalink
fix: pdf_summary delete on application update (#3356)
Browse files Browse the repository at this point in the history
  • Loading branch information
rikuke authored Sep 26, 2024
1 parent 6ce299f commit 508b66c
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,13 @@ def _validate_attachments(self, instance):
valid_attachment_types = {req[0] for req in attachment_requirements}
attachments_with_invalid_type = []

for attachment in instance.attachments.all().order_by("created_at"):
for attachment in (
# exclude the PDF summary from the list of attachments,
# otherwise it may get deleted
instance.attachments.filter()
.exclude(attachment_type=AttachmentType.PDF_SUMMARY)
.order_by("created_at")
):
if attachment.attachment_type == AttachmentType.EMPLOYEE_CONSENT:
# validated separately
continue
Expand Down

0 comments on commit 508b66c

Please sign in to comment.