class documentation
class ModelChoiceField(ChoiceField): (source)
Known subclasses: django.forms.models.ModelMultipleChoiceField
A ChoiceField whose choices are a model QuerySet.
Method | __deepcopy__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | get |
Return ``limit_choices_to`` for this form field. |
Method | has |
Return True if data differs from initial. |
Method | label |
Convert objects into strings and generate the labels for the choices presented by this object. Subclasses can override this method to customize the display of the choices. |
Method | prepare |
Undocumented |
Method | to |
Return a string. |
Method | validate |
Validate that the input is in self.choices. |
Class Variable | choices |
Undocumented |
Class Variable | default |
Undocumented |
Instance Variable | empty |
Undocumented |
Instance Variable | limit |
Undocumented |
Instance Variable | queryset |
Undocumented |
Instance Variable | to |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _set |
Undocumented |
Instance Variable | _queryset |
Undocumented |
Inherited from ChoiceField
:
Method | valid |
Check to see if the provided value is a valid choice. |
Method | _set |
Undocumented |
Instance Variable | _choices |
Undocumented |
Inherited from Field
(via ChoiceField
):
Method | bound |
Return the value that should be shown for this field on render of a bound form, given the submitted POST data for the field and the initial data, if any. |
Method | clean |
Validate the given value and return its "cleaned" value as an appropriate Python object. Raise ValidationError for any errors. |
Method | get |
Return a BoundField instance that will be used when accessing the form field in a template. |
Method | run |
Undocumented |
Method | widget |
Given a Widget instance (*not* a Widget class), return a dictionary of any HTML attributes that should be added to the Widget, based on this Field. |
Class Variable | default |
Undocumented |
Class Variable | empty |
Undocumented |
Instance Variable | disabled |
Undocumented |
Instance Variable | error |
Undocumented |
Instance Variable | help |
Undocumented |
Instance Variable | initial |
Undocumented |
Instance Variable | label |
Undocumented |
Instance Variable | label |
Undocumented |
Instance Variable | localize |
Undocumented |
Instance Variable | required |
Undocumented |
Instance Variable | show |
Undocumented |
Instance Variable | validators |
Undocumented |
Instance Variable | widget |
Undocumented |
def __init__(self, queryset, *, empty_label='---------', required=True, widget=None, label=None, initial=None, help_text='', to_field_name=None, limit_choices_to=None, blank=False, **kwargs):
(source)
¶
overrides
django.forms.fields.ChoiceField.__init__
overridden in
django.forms.models.ModelMultipleChoiceField
Undocumented
Return ``limit_choices_to`` for this form field. If it is a callable, invoke it and return the result.
overrides
django.forms.fields.Field.has_changed
overridden in
django.forms.models.ModelMultipleChoiceField
Return True if data differs from initial.
Convert objects into strings and generate the labels for the choices presented by this object. Subclasses can override this method to customize the display of the choices.
overrides
django.forms.fields.Field.prepare_value
overridden in
django.forms.models.ModelMultipleChoiceField
Undocumented