-
Notifications
You must be signed in to change notification settings - Fork 87
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
Convert underscore to hyphens in generic attributes names #524
base: main
Are you sure you want to change the base?
Conversation
Yes, please merge these changes. |
@dyve is this something you'd be interested to merge? If so I will complete this with tests to make it actually mergeable |
The idea of converting data_ tot data- is interesting. For anything not starting with data_, it becomes a possible risk I think. |
the idea behind this PR is to allow integrating htmx attributes ( |
Ok, Let's see it. |
@dyve this is a first draft. I included tests to check that no existing attribute is altered |
Came here to open an issue about this. Being able to add arbitrary attributes is almost a necessity these days, and it in the template seems less hacky than setting it on the python side. Although this only seems to work for buttons, it would be great if we could pass through extra attributes for fields as well. |
I'm interested in this solution as well. Right now I use a custom template tag and overwrite the django_bootstrap5 |
This looks pretty useful! With the A possible addition is to support custom prefixes through a setting. That offers options to:
It should be straightforward to maintain, and leaves an option for users wanting custom prefixes. |
I’ll try to push an update for this in the coming weeks. |
I'm actually trying to figure it out right now, watch this space. |
See #737 |
Just a draft idea to address #267 to see if there is any interesting in solving the issue
The change replace
_
to-
in generic tag attributesSo i can do something like
{% bootstrap_button data_bs_toggle="collapse" data_bs_target="#update-group-9" button_type="reset" content="Cancel" %}
Generic attributes (like
data_bs_toggle
) are passed torender_tag
without any changes while templatetag arguments (likebutton_type
) are not, so it's safe to make this change without interfering django-bootstrap5 behaviour