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

Issue 1682 #1932

Closed
wants to merge 3 commits into from
Closed

Issue 1682 #1932

wants to merge 3 commits into from

Conversation

bkdekoning
Copy link
Contributor

Description

Added functionality where the toolbar inspects the loaded HTML content for a form that includes a file input but does not have the encoding type set to multipart/form-data, and warns the user if so.

Subclassed Python's HTML parser and added a function called check_invalid_file_form_configuration in panels/templates/panel.py. The function checks all forms for a file input type and, if it exists, checks if the form has encoding type multipart/form-data. If it does not, the error message is shown in the Templates panel by passing it to record_stats. It also amends the nav_subtitle property of the panel to notify the user that there is an issue with their template. Added three tests and checked that the test suite passes for all compatible versions of Django and Python through Tox.

Fixes #1682

Checklist:

  • I have added the relevant tests for this change.
  • I have added an item to the Pending section of docs/changes.rst.

@bkdekoning bkdekoning marked this pull request as draft June 7, 2024 15:11
@bkdekoning bkdekoning closed this Jun 7, 2024
@bkdekoning bkdekoning deleted the issue_1682 branch June 8, 2024 18:15
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.

Log when form is using file fields without proper enctype attribute on the form.
1 participant