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

Fix DeprecationWarnings about form default templates #1878

Merged
merged 5 commits into from Feb 22, 2024

Conversation

pfouque
Copy link
Member

@pfouque pfouque commented Feb 8, 2024

Description

Improve Django5 compatibility by solving warnings related to form default templates that will change with Django5 from table to div

Fixes # (issue)

#1813

Checklist:

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

@pfouque pfouque self-assigned this Feb 8, 2024
Copy link
Member

@matthiask matthiask left a comment

Choose a reason for hiding this comment

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

Are we rendering table rows right now also?

as_table doesn't render the surrounding <table> element.

django/forms/utils.py-90-        """Render as <tr> elements excluding the surrounding <table> tag."""
django/forms/utils.py-91-        return self.render(self.template_name_table)

The HTML generated here isn't correct it seems to me.

@pfouque
Copy link
Member Author

pfouque commented Feb 8, 2024

Weirdly, during my tests, both as_div and as_table were only rendering the <input>.
But I agree it would probably make more sense to use as_div

@tim-schilling
Copy link
Contributor

It's likely because there's no need to render any additional html around a hidden input so both .as_div and .as_table are resulting in the same output. If we were to add another field input, then the problem would be realized.

@matthiask
Copy link
Member

Maybe the time has come for us to move to Django>=4.2?

Django 3.2 LTS support ends this April https://www.djangoproject.com/download/

@tim-schilling
Copy link
Contributor

Let's confirm there isn't anything wrong with update on fetch with @living180 first. If there isn't, I'm good with dropping 3.2 early.

@matthiask
Copy link
Member

Yes, that's a good idea.

I have submitted #1880 anyway.

@matthiask matthiask merged commit b9e4af7 into jazzband:main Feb 22, 2024
26 checks passed
@pfouque pfouque deleted the fix_dj5_form_template branch February 23, 2024 06:06
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.

None yet

3 participants