Login

3 snippets

Snippet List

Form field with fixed value

In case you need a form field that only has one acceptable value, you can create a custom form field derived from `forms.ChoiceField` which only accepts one choice. Alternatively you can: * Ignore the value of such a field entirely. * Simply pass a single choice to a the `forms.ChoiceField`

  • forms
  • field
Read More

Add Toggle Switch Widget to Django Forms

Implementation Suggestions use: ``` ....... widgets = { ...... }), 'solicitada_mpu': ToggleSwitchWidget(size='sm', active_color='#9333ea', inactive_color='#ccc', active_text='YES', inactive_text='NO' ), ............... ```

  • ToggleSwitchWidget
  • toggle-switches
Read More