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

Always render hidden CSRF token input in reusable non-crispy templates #3157

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

podliashanyk
Copy link
Contributor

@podliashanyk podliashanyk commented Nov 5, 2024

A more robust version of #3056

This implementation means that CSRF token will be rendered also for GET forms (not so rare form type in NAV) which is a slight redundancy. At the same time it is a worthwhile one since this change means that _form_content.html template becomes reusable by forms that were originally non-crispy (with auto-included CSRF token). This is very handy for campus task # 45. Note that there is no (reliable) way to check whether a Django form is a POST form thats why this redundancy is needed.

Also see: #3140 (comment)

@podliashanyk podliashanyk requested a review from a team November 5, 2024 12:08
@podliashanyk podliashanyk self-assigned this Nov 5, 2024
Copy link

github-actions bot commented Nov 5, 2024

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON black 992 0 11.14s
✅ PYTHON ruff 987 0 0.1s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

Copy link

github-actions bot commented Nov 5, 2024

Test results

    9 files      9 suites   8m 31s ⏱️
2 135 tests 2 135 ✅ 0 💤 0 ❌
4 009 runs  4 009 ✅ 0 💤 0 ❌

Results for commit 713ce0f.

♻️ This comment has been updated with latest results.

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.41%. Comparing base (05dfb18) to head (713ce0f).
Report is 18 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3157      +/-   ##
==========================================
- Coverage   60.45%   60.41%   -0.04%     
==========================================
  Files         605      605              
  Lines       43745    43734      -11     
  Branches       48       48              
==========================================
- Hits        26448    26424      -24     
- Misses      17285    17298      +13     
  Partials       12       12              

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

Copy link
Contributor

@johannaengland johannaengland left a comment

Choose a reason for hiding this comment

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

Very good, let's do this!

@johannaengland
Copy link
Contributor

But I would like to see a changelog file for this change

Copy link

sonarcloud bot commented Nov 6, 2024

@podliashanyk podliashanyk merged commit ca3d09f into master Nov 7, 2024
13 of 14 checks passed
@podliashanyk podliashanyk deleted the fix-csrf-token-rendering-in-form-template branch November 7, 2024 08:57
johannaengland added a commit that referenced this pull request Nov 12, 2024
johannaengland added a commit that referenced this pull request Nov 12, 2024
johannaengland added a commit that referenced this pull request Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants