Helper functions for creating Form classes from Django models and database field objects.
Class |
|
A formset for child objects related to a parent. |
Class |
|
No class docstring; 0/2 instance variable, 4/8 methods documented |
Class |
|
A ``FormSet`` for editing a queryset and/or adding new objects to it. |
Class |
|
A basic integer field that deals with validating the given value to a given parent instance in an inline. |
Class |
|
A ChoiceField whose choices are a model QuerySet. |
Class |
|
Undocumented |
Class |
|
Undocumented |
Class |
|
Undocumented |
Class |
|
Undocumented |
Class |
|
Undocumented |
Class |
|
A MultipleChoiceField whose choices are a model QuerySet. |
Function | apply |
Apply limit_choices_to to the formfield's queryset if needed. |
Function | construct |
Construct and return a model instance from the bound ``form``'s ``cleaned_data``, but do not save the returned instance to the database. |
Function | fields |
Return a dictionary containing form fields for the given model. |
Function | inlineformset |
Return an ``InlineFormSet`` for the given kwargs. |
Function | model |
Return a dict containing the data in ``instance`` suitable for passing as a Form's ``initial`` keyword argument. |
Function | modelform |
Undocumented |
Function | modelform |
Return a ModelForm containing form fields for the given model. You can optionally pass a `form` argument to use as a starting point for constructing the ModelForm. |
Function | modelformset |
Return a FormSet class for the given Django model class. |
Constant | ALL |
Undocumented |
Function | _get |
Find and return the ForeignKey from model to parent if there is one (return None if can_fail is True and no such field exists). If fk_name is provided, assume it is the name of the ForeignKey field. Unless can_fail is True, raise an exception if there isn't a ForeignKey from model to parent_model. |
Construct and return a model instance from the bound ``form``'s ``cleaned_data``, but do not save the returned instance to the database.
Return a dictionary containing form fields for the given model. ``fields`` is an optional list of field names. If provided, return only the named fields. ``exclude`` is an optional list of field names. If provided, exclude the named fields from the returned fields, even if they are listed in the ``fields`` argument. ``widgets`` is a dictionary of model field names mapped to a widget. ``formfield_callback`` is a callable that takes a model field and returns a form field. ``localized_fields`` is a list of names of fields which should be localized. ``labels`` is a dictionary of model field names mapped to a label. ``help_texts`` is a dictionary of model field names mapped to a help text. ``error_messages`` is a dictionary of model field names mapped to a dictionary of error messages. ``field_classes`` is a dictionary of model field names mapped to a form field class. ``apply_limit_choices_to`` is a boolean indicating if limit_choices_to should be applied to a field's queryset.
Return an ``InlineFormSet`` for the given kwargs. ``fk_name`` must be provided if ``model`` has more than one ``ForeignKey`` to ``parent_model``.
Return a dict containing the data in ``instance`` suitable for passing as a Form's ``initial`` keyword argument. ``fields`` is an optional list of field names. If provided, return only the named. ``exclude`` is an optional list of field names. If provided, exclude the named from the returned dict, even if they are listed in the ``fields`` argument.
Return a ModelForm containing form fields for the given model. You can optionally pass a `form` argument to use as a starting point for constructing the ModelForm. ``fields`` is an optional list of field names. If provided, include only the named fields in the returned fields. If omitted or '__all__', use all fields. ``exclude`` is an optional list of field names. If provided, exclude the named fields from the returned fields, even if they are listed in the ``fields`` argument. ``widgets`` is a dictionary of model field names mapped to a widget. ``localized_fields`` is a list of names of fields which should be localized. ``formfield_callback`` is a callable that takes a model field and returns a form field. ``labels`` is a dictionary of model field names mapped to a label. ``help_texts`` is a dictionary of model field names mapped to a help text. ``error_messages`` is a dictionary of model field names mapped to a dictionary of error messages. ``field_classes`` is a dictionary of model field names mapped to a form field class.
Return a FormSet class for the given Django model class.