module documentation

Utility functions.

Function form_from_initial Create a form instance with the defined initial data.
Type Variable T Undocumented
Variable logger Undocumented
def form_from_initial(cls: type[T], **kwargs: Any) -> T:

Create a form instance with the defined initial data.

Form fields are typically defined with initial values. And Django's forms allow extracting this initial values from an instance of a form. So, what this helper function does is inspect all fields of a form, extract the initial values, and then creates a new form instance with these initial values.

Any additional keyword arguments are directly passed to the form constructor.

T =

Undocumented

Value
TypeVar('FormT',
        bound=Form)
logger =

Undocumented