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

384: Make nocache optional #385

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jcarizza
Copy link


name: Make nocache optional
about: Ignore nocache based in a settings flag to not corrupt the S3 querysting signed URL
assignees: fabiocaccamo


Describe your changes

  • Added a setting flag
  • Change templates to not include md5 hash

Related issue
#384

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests for the proposed changes.
  • I have run the tests and there are not errors.

Copy link

codecov bot commented Apr 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.39%. Comparing base (3293bea) to head (566bc8b).
Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #385      +/-   ##
==========================================
+ Coverage   97.35%   97.39%   +0.04%     
==========================================
  Files          38       38              
  Lines         416      423       +7     
==========================================
+ Hits          405      412       +7     
  Misses         11       11              
Flag Coverage Δ
unittests 97.39% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fabiocaccamo fabiocaccamo self-requested a review April 30, 2024 07:34
@fabiocaccamo fabiocaccamo added the enhancement New feature or request label Apr 30, 2024
Copy link
Owner

@fabiocaccamo fabiocaccamo left a comment

Choose a reason for hiding this comment

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

@jcarizza instead of adding a new setting, I would add a new template tag admin_interface_static which wraps the static template tag and that automatically adds the nocache parameter only if the url starts with STATIC_URL settings (simple yet effective and zero configuration needed).

I'm sorry that you worked in another direction, I would suggest you to discuss the solution in the issue before working on a PR the next time, anyway... thank you very much for this PR!

@jcarizza
Copy link
Author

Hi @fabiocaccamo

Sorry I sent the PR before a previous discussion, I needed to fix that ASAP in my application.

I think this solution would be less intrusive and simpliest.

The new template tag will check if the files are the default django storage or if they start with STATIC_URL and add or remove the nocache tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

None yet

2 participants