readthedocs / readthedocs/ext-theme

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

Open
#210 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Improvement Needed: design decision
Dominant language
HTML
Stars
12
Forks
6
Avg merge
13h 25m
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading readthedocsext/theme/templatetags/ext_theme_tags.py at the linked helper implementation, then inspect the templates that currently render forms with {{ form | crispy }}. Trace how the internal helpers alter fields and identify the forms affected by individual field rendering. Done means the internal helpers are replaced with django-widget-tweaks while the existing form behavior remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.