Skip to content

Commit

Permalink
[#3688] Improve typing for submission attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos authored and sergei-maertens committed Mar 22, 2024
1 parent 1d922e5 commit be09f15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/openforms/submissions/models/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,9 @@ def get_attachments(self) -> "SubmissionFileAttachmentQuerySet":

return SubmissionFileAttachment.objects.for_submission(self)

attachments = property(get_attachments)
@property
def attachments(self) -> "SubmissionFileAttachmentQuerySet":
return self.get_attachments()

def get_merged_attachments(self) -> Mapping[str, list["SubmissionFileAttachment"]]:
if not hasattr(self, "_merged_attachments"):
Expand Down
4 changes: 3 additions & 1 deletion src/openforms/submissions/models/submission_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ class Meta:
verbose_name_plural = _("temporary file uploads")


class SubmissionFileAttachmentQuerySet(DeleteFilesQuerySetMixin, models.QuerySet):
class SubmissionFileAttachmentQuerySet(
DeleteFilesQuerySetMixin, models.QuerySet["SubmissionFileAttachment"]
):
def for_submission(self, submission: Submission):
return self.filter(submission_step__submission=submission)

Expand Down

0 comments on commit be09f15

Please sign in to comment.