Opened 4 years ago

Last modified 4 years ago

#31892 closed Cleanup/optimization

[Regression][Widgets][Media] render_js — at Initial Version

Reported by: Buky Owned by: nobody
Component: Documentation Version: 3.1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

For Django in 3.0 and before when Media is used (forms.widgets.py), the method render_js will produce:

<script type="text/javascript" src="file.js"></script>

but in Django 3.1 we get:

<script src="file.js"></script>

This change is uncovered in Django 3.1 release notes(https://docs.djangoproject.com/en/3.1/releases/3.1/). Does it a regression?

Django > 3.1:

def render_js(self):
        return [
            format_html(
                '<script type="text/javascript" src="{}"></script>',
                self.absolute_path(path)
            ) for path in self._js
        ]

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top