Skip to content

Multiple calls to static files for django-prose-editor when registering to admin #48

Closed
@jsa34

Description

@jsa34

Hello,

I have created a custom ProseEditorField to use in my code:

class CustomProseEditorField(ProseEditorField):
    def __init__(self, *args, **kwargs):
        kwargs.setdefault(
            "extensions",
            {
                "Bold": True,
                "Italic": True,
                "Underline": True,
                "BulletList": True,
                "OrderedList": True,
                "HardBreak": True,
                "Link": {
                    "enableTarget": True,
                },
                "Heading": {"levels": [1, 2, 3, 4, 5, 6]},
                "History": True,
                "HTML": False,
            },
        )
        kwargs.setdefault("sanitize", True)

        super().__init__(*args, **kwargs)

which I am using for all the model fields that need to use rich text.

I have one model with a very large number of fields, many of which are using CustomProseEditorField. Upon registering the model for admin and opening the model admin, it shows in a large number of calls when looking at Django debug toolbar to fetch the static resources. Is there a way to avoid this and make a single call for each required resource (such as editor.js and configurable.js) when opening this model in the model admin? I haven't customised or called the widgets in anyway and only setting the prose editor as described above.

I hope this makes sense!

Many thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions