• 
      

    Fix fieldset classes for settings forms.

    Review Request #14686 — Created Nov. 11, 2025 and submitted

    Information

    Review Board
    release-7.1.x

    Reviewers

    In admin model forms, the change_form_fieldsets templatetag will
    instantiate an adapter object to convert django's builtin class names
    (like 'wide') to our form CSS class names ('-is-wide').

    For settings forms, the template doesn't (and really can't) use that
    templatetag, since a settings form is different from an adminform. In
    these cases we were still using the django class names, which resulted
    in using 'wide' as the class name, which wasn't correct.

    This change makes our djblets_forms fieldset template check for the
    'wide' class, and add '-is-wide' if found.

    Viewed settings forms in the admin and saw that fieldsets now had the
    correct class name, and that we now had a match between the label widths
    in regular fieldsets and in subforms (which go through slightly
    different templates, ugh).

    Summary ID
    Fix fieldset classes for settings forms.
    In admin model forms, the `change_form_fieldsets` templatetag will instantiate an adapter object to convert django's builtin class names (like 'wide') to our form CSS class names ('-is-wide'). For settings forms, the template doesn't (and really can't) use that templatetag, since a settings form is different from an adminform. In these cases we were still using the django class names, which resulted in using 'wide' as the class name, which wasn't correct. This change makes our djblets_forms fieldset template check for the 'wide' class, and add '-is-wide' if found. Testing Done: Viewed settings forms in the admin and saw that fieldsets now had the correct class name, and that we now had a match between the label widths in regular fieldsets and in subforms (which go through slightly different templates, ugh).
    xrylqmynpopwlosysuypopzmunklpprx
    Description From Last Updated

    I think this change is fine, but I also feel like it'd be nice if we just let wide stay …

    chipx86 chipx86
    chipx86
    1. 
        
    2. Show all issues

      I think this change is fine, but I also feel like it'd be nice if we just let wide stay a valid value for these for consistency (sort of control mode for forms) and adapt it during render. That way settings forms and admin forms don't have to be different here. Is that doable?

      1. That would be a pretty big, invasive project. Settings forms themselves aren't necessarily always in the admin site, and the way templates inherit currently goes back and forth between the Djblets and Review Board codebases.

        This is something I'd like to address in the new forms work instead.

      2. Been thinking on this and poking at it, and I don't think it would. I do think it's worth keeping compatibility, because wide is basically at this point part of fieldset definition API.

        Fieldset classes are controlled entirely by Review Board in reviewboard/templates/forms/fieldset.html, and this supports adding extra fieldsets.

        That's inherited by reviewboard/templates/djblets_forms/admin/form_fieldset.html, which handles these admin fieldsets. This is all that's needed in that file to support this:

        {% load djblets_utils %}
        
        {% if fieldset.classes and fieldset.classes|contains:"wide" %}
        {%  definevar "extra_fieldset_classes" %}{{extra_fieldset_classes}} -is-wide{% enddefinevar %}
        {% endif %}
        
        
        {% include "forms/fieldset.html" %}
        

        There's no harm in leaving wide in there.

    3. 
        
    maubin
    1. Ship It!
    2. 
        
    david
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-7.1.x (3be3e63)