-
Notifications
You must be signed in to change notification settings - Fork 0
Attribute helpers for JSON data attributes #15
Copy link
Copy link
Open
Description
There are cases where frameworks configure behavior by setting a JSON object in a HTML element data attribute, e.g. Alpine.JS, Preline UI.
A helper is useful in these cases.
Real example with Preline UI:
config = {
"url": reverse("profile-picture-upload"),
"acceptedFiles": "image/*",
"maxFiles": 1,
"singleton": True,
"paramName": "profile_picture",
"previewsContainer": "#profile-picture-preview",
"headers": {
"X-CSRFToken": get_token(request),
},
}
with html.Div(
class_="inline-block dz-max-files-reached",
data_hs_file_upload=safe(json.dumps(config)),
):
...Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Projects
Status
No status