db.models.Field.many_to_one

Field.many_to_one Boolean flag that is True if the field has a many-to-one relation, such as a ForeignKey; False otherwise.

db.models.Field.many_to_many

Field.many_to_many Boolean flag that is True if the field has a many-to-many relation; False otherwise. The only field included with Django where this is True is ManyToManyField.

db.models.Field.get_prep_value()

get_prep_value(value) [source] value is the current value of the model’s attribute, and the method should return data in a format that has been prepared for use as a parameter in a query. See Converting Python objects to query values for usage.

db.models.Field.help_text

Field.help_text Extra “help” text to be displayed with the form widget. It’s useful for documentation even if your field isn’t used on a form. Note that this value is not HTML-escaped in automatically-generated forms. This lets you include HTML in help_text if you so desire. For example: help_text="Please use the following format: <em>YYYY-MM-DD</em>." Alternatively you can use plain text and django.utils.html.escape() to escape any HTML special characters. Ensure that you escap

db.models.Field.get_db_prep_save()

get_db_prep_save(value, connection) [source] Same as the get_db_prep_value(), but called when the field value must be saved to the database. By default returns get_db_prep_value().

db.models.Field.from_db_value()

from_db_value(value, expression, connection, context) Converts a value as returned by the database to a Python object. It is the reverse of get_prep_value(). This method is not used for most built-in fields as the database backend already returns the correct Python type, or the backend itself does the conversion. See Converting values to Python objects for usage. Note For performance reasons, from_db_value is not implemented as a no-op on fields which do not require it (all Django fields).

db.models.Field.get_internal_type()

get_internal_type() [source] Returns a string naming this field for backend specific purposes. By default, it returns the class name. See Emulating built-in field types for usage in custom fields.

db.models.Field.get_db_prep_value()

get_db_prep_value(value, connection, prepared=False) [source] Converts value to a backend-specific value. By default it returns value if prepared=True and get_prep_value() if is False. See Converting query values to database values for usage. When loading data, from_db_value() is used:

db.models.Field.formfield()

formfield(form_class=None, choices_form_class=None, **kwargs) [source] Returns the default django.forms.Field of this field for ModelForm. By default, if both form_class and choices_form_class are None, it uses CharField. If the field has choices and choices_form_class isn’t specified, it uses TypedChoiceField. See Specifying the form field for a model field for usage.

db.models.Field.description

description A verbose description of the field, e.g. for the django.contrib.admindocs application. The description can be of the form: description = _("String (up to %(max_length)s)") where the arguments are interpolated from the field’s __dict__. To map a Field to a database-specific type, Django exposes several methods: