diff --git a/controlpanel/forms.py b/controlpanel/forms.py index 4ebabe7..60d822a 100644 --- a/controlpanel/forms.py +++ b/controlpanel/forms.py @@ -83,9 +83,19 @@ class FlagForm(forms.ModelForm): class PlanForm(forms.ModelForm): + """Field order is chosen for the two-column modal (see _form_fields.html): description + spans both columns, so pairing name with duration and the two day-counts with each other + fills every row instead of leaving half of one empty. + + name | duration_months + description ....................... (spans both) + renewal_lead_days | grace_days + is_trial | is_active + """ + class Meta: model = Plan - fields = ["name", "description", "duration_months", "renewal_lead_days", "grace_days", "is_trial", "is_active"] + fields = ["name", "duration_months", "description", "renewal_lead_days", "grace_days", "is_trial", "is_active"] class PlanPriceForm(forms.ModelForm): diff --git a/controlpanel/templates/controlpanel/_form_fields.html b/controlpanel/templates/controlpanel/_form_fields.html index 75b4c70..d592f3c 100644 --- a/controlpanel/templates/controlpanel/_form_fields.html +++ b/controlpanel/templates/controlpanel/_form_fields.html @@ -4,14 +4,22 @@ The field loop every card-form and modal-form wrapper shares: label, daisyUI-styled widget, help text, errors — with checkboxes laid out label-beside-input instead of label-above. Included with `form`. + + Pass `two_columns` to lay the fields out in two columns instead of one — for a form with + several short fields (a handful of day counts, say) that would otherwise make a modal + taller than the screen. Textareas and file inputs always span the full width regardless: + half a row is not enough to type a description into. Single column below `sm`, since two + columns of form fields on a phone is worse than a long scroll. {% endcomment %} {% for error in form.non_field_errors %}