Opened 6 hours ago

Closed 5 hours ago

#36136 closed New feature (wontfix)

New form field for toggle inputs

Reported by: Hristo Trendafilov Owned by:
Component: Forms Version:
Severity: Normal Keywords: togglefield, toggle, field
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Hristo Trendafilov)

Toggle inputs are quite common web elements and are widely used in modern web pages, CSS frameworks, etc.

Those could be narrowed down to the BooleanField but with several key differences:

  • They never be required, even if defied like so;
  • They should always return cleaned data to be False if not passed in the form data;
  • They should always have an initial value of False unless explicitly defined;
  • On invalid form data those should not raise ValidationError, but cast the value to False;
  • They have a special widget, based on the CheckboxInput, but adding role="switch" and aria-checked="false/true"/based on the value/;

Change History (2)

comment:1 by Hristo Trendafilov, 5 hours ago

Description: modified (diff)

comment:2 by Sarah Boyce, 5 hours ago

Resolution: wontfix
Status: newclosed

As you are requesting a new feature for Django, you need to first propose and discuss the idea with the community and gain consensus. To do that, please consider starting a new conversation on the Django Forum, where you'll reach a broader audience and receive additional feedback.

Personally, I don't see a strong reason to add this to core considering folks can write their own custom widgets.

I'll close the ticket for now, but if the community agrees with the proposal, please return to this ticket and reference the forum discussion so we can re-open it. For more information, please refer to the documented guidelines for requesting features.

Thanks!

Note: See TracTickets for help on using tickets.
Back to Top