django-bootstrap-datepicker-plus
django-bootstrap-datepicker-plus copied to clipboard
Consider using a data attribute rather than dp_config
Hi,
Describe the bug
It seems this Django widget is using the dp_config attribute to pass the datepicker configuration to the JS side (https://github.com/monim67/django-bootstrap-datepicker-plus/blob/22c4299019cb6328eed2938598e323c0d43c5e9a/bootstrap_datepicker_plus/static/bootstrap_datepicker_plus/js/datepicker-widget.js#L7).
It seems this is coming from the Django wrapper and not the underlying Bootstrap DatePicker library (as far as I know).
This is not a big deal but such an attribute (dp_config) is not a valid HTML attribute. Therefore, it makes automatic testing of the HTML validity of pages more difficult as one has to ignore all these false positives.
The standard way of doing this now seems to be using data- attributes (https://developer.mozilla.org/fr/docs/Web/HTML/Attributs_universels/data-*). What about moving to something like data-dp-config?
To Reproduce Steps to reproduce the behavior:
- Create a template calling this widget.
- Run W3C validator (https://validator.w3.org/nu/) on the resulting HTML.
Expected behavior HTML should be valid.
Thanks!
Thanks for your feedback, it will be implemented in next release.
Thanks!
@monim67: I was really excited to see a new release today, but it seems the fix for this issue didn't make it into 3.0.6. Would it be possible to do a 3.0.7 release with this fix soonish?
If there is anything I can do to help getting this merged, such as preparing a pull request, please let me know.
I will fix few more issues over the week and release a new version next week, thanks for the suggestion :+1:
Thanks!