django_sorcery.fields module¶
Field mapping from SQLAlchemy type’s to form fields.
-
class
django_sorcery.fields.EnumField(enum_class=None, choices=None, **kwargs)[source]¶ Bases:
django.forms.fields.ChoiceFieldForm field for using an Enum as choices.
-
bound_data(data, initial)[source]¶ 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.
For most fields, this will simply be data; FileFields need to handle it a bit differently.
-
empty_value= None¶
-
-
class
django_sorcery.fields.ModelChoiceField(model, session, empty_label='---------', required=True, widget=None, label=None, initial=None, help_text='', to_field_name=None, limit_choices_to=None, **kwargs)[source]¶ Bases:
django.forms.fields.ChoiceFieldA ChoiceField whose choices are a sqlalchemy model relationship.
-
choices¶
-
default_error_messages= {'invalid_choice': 'Select a valid choice. That choice is not one of the available choices.'}¶
-
get_bound_field(form, field_name)[source]¶ Return a BoundField instance that will be used when accessing the form field in a template.
-
get_limit_choices_to()[source]¶ Returns limit_choices_to for this model.
If it is a callable, invoke it and return the result
-
iterator¶ alias of
ModelChoiceIterator
-
queryset¶
-
-
class
django_sorcery.fields.ModelChoiceIterator(field)[source]¶ Bases:
objectIterator for sqlalchemy query for model choice fields.
-
class
django_sorcery.fields.ModelMultipleChoiceField(*args, **kwargs)[source]¶ Bases:
django_sorcery.fields.ModelChoiceFieldA ChoiceField whose choices are a sqlalchemy model list relationship.
-
default_error_messages= {'invalid_choice': 'Select a valid choice. %(value)s is not one of the available choices.', 'list': 'Enter a list of values.'}¶
alias of
django.forms.widgets.MultipleHiddenInput
-
widget¶ alias of
django.forms.widgets.SelectMultiple
-