Opened 3 years ago

Closed 3 years ago

#33241 closed New feature (duplicate)

support for script type="module" in django admin Form Media

Reported by: Thomas Grainger Owned by: nobody
Component: contrib.admin Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'd like to be able to add ESM modules to my Forms and Widgets eg:

@attr.frozen
class JS:
    type: Literal["application/json", "module"] = "application/json"
    src: str

@admin.register(MyModel)
class MyModelAdmin(admin.ModelAdmin):

    class Media:
        js = (JS(type="module", src='js/my_script.js'),)

see also https://stackoverflow.com/questions/56232944/how-to-add-script-type-module-in-django-admin

Change History (2)

comment:1 by Mariusz Felisiak, 3 years ago

Component: Uncategorizedcontrib.admin
Type: UncategorizedNew feature

The Django admin doesn't use ESM modules, so far as I'm aware we can close is as a duplicate of more general ticket #9357.

comment:2 by Mariusz Felisiak, 3 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top