Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance for attachments xform meta permissions check #2499

Merged
merged 3 commits into from
Nov 6, 2023

Conversation

KipSigei
Copy link
Contributor

@KipSigei KipSigei commented Nov 3, 2023

Changes / Features implemented

  • Update _xform_filter to handle attachments

Steps taken to verify this change does what is intended

Side effects of implementing this change

Before submitting this PR for review, please make sure you have:

  • Included tests
  • Updated documentation

Closes #

attachment_id = view.kwargs.get("pk")
attachment = get_object_or_404(Attachment, pk=attachment_id)
xform = attachment.instance.xform.pk
self.xform = get_object_or_404(XForm, pk=xform)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we do self.xform = attachment.instance.xform and avoid getting the xform again?

Signed-off-by: Kipchirchir Sigei <[email protected]>
@KipSigei KipSigei merged commit a22a9de into main Nov 6, 2023
8 checks passed
@KipSigei KipSigei deleted the update-attachment-url branch November 6, 2023 11:55
@KipSigei KipSigei mentioned this pull request Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants