Skip to content
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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

yakky
Copy link

@yakky yakky commented Jul 20, 2023

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 attributes

So 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 to render_tag without any changes while templatetag arguments (like button_type) are not, so it's safe to make this change without interfering django-bootstrap5 behaviour

@apapsch
Copy link

apapsch commented Apr 16, 2024

Just a draft idea to address #267 to see if there is any interesting in solving the issue

Yes, please merge these changes.

@yakky
Copy link
Author

yakky commented Apr 27, 2024

@dyve is this something you'd be interested to merge? If so I will complete this with tests to make it actually mergeable

@dyve
Copy link
Member

dyve commented Apr 27, 2024

The idea of converting data_ tot data- is interesting. For anything not starting with data_, it becomes a possible risk I think.

@yakky
Copy link
Author

yakky commented Apr 27, 2024

the idea behind this PR is to allow integrating htmx attributes (hx-*) which is currently not possible to support

@dyve
Copy link
Member

dyve commented Apr 27, 2024

Ok, Let's see it.

@yakky
Copy link
Author

yakky commented Apr 27, 2024

@dyve this is a first draft. I included tests to check that no existing attribute is altered

@yakky yakky marked this pull request as ready for review July 6, 2024 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants