readthedocs / ext-theme

Read the Docs drop in replacement site templates
2 stars 2 forks source link

Replace internal form field tags/filters with django-widget-tweaks #210

Open agjohnson opened 1 year ago

agjohnson commented 1 year ago

I just learned of this package: https://github.com/jazzband/django-widget-tweaks

It is a much more thorough and useful implementation compared to the internal tag/filter template helpers that I put together ^1. I use the internal helpers for altering the form and form fields at display time, for adding data-bind attributes and CSS classes. I've wanted to expand these patterns a little more too, but the widget-tweaks is exactly what I'd want to write.

The main blocker here is that most forms are displayed as {{ form | crispy }}. Using this package would involve rendering each field individually. The pattern I have now alters the field in place, so the rendering call doesn't change. This is probably a minor change, and can likely be a loop over the form fields.