Forms — Django Kaos Utils documentation

# Forms

- Forms

- Fields

## Forms

class dj_kaos_utils.forms.UnrequiredFieldsFormMixin(*args, **kwargs)

  Bases: `BaseForm`

  Make fields denoted by unrequired_fields be not required on the form

dj_kaos_utils.forms.unrequire_form(form_or_model_cls: Union[Type[BaseForm], Type[Model]], unrequired_fields: Sequence[str])

  Make fields denoted by unrequired_fields be not required on the form or model form denoted by form_or_model_cls.

  Parameters

    - form_or_model_cls – Form class or model class to create a model form out of

    - unrequired_fields – Fields that should become not required

  Returns

    Form class with fields denoted by unrequired_fields not required.

## Fields

class dj_kaos_utils.forms.ListTextWidget(datalist, name, *args, **kwargs)

  Bases: `TextInput`

  A Django form widget that renders a text input with a datalist populated with options from a given list.

  Example:

        >>> class MyForm(forms.Form):
        >>>     my_field = forms.CharField(widget=ListTextWidget(datalist=['option1', 'option2', 'option3']))