Package django :: Package db :: Package models :: Package fields :: Class Field
[hide private]
[frames] | no frames]

Class Field

source code

object --+
         |
        Field

Instance Methods [hide private]
 
__init__(self, verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, core=False, rel=None, default=NOT_PROVIDED, editable=True, serialize=True, prepopulate_from=None, unique_for_date=None, unique_for_month=None, unique_for_year=None, validator_list=None, choices=None, radio_admin=None, help_text='', db_column=None, db_tablespace=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__cmp__(self, other) source code
 
to_python(self, value)
Converts the input value into the expected Python data type, raising validators.ValidationError if the data can't be converted.
source code
 
db_type(self)
Returns the database column data type for this field, taking into account the DATABASE_ENGINE setting.
source code
 
validate_full(self, field_data, all_data)
Returns a list of errors for this field.
source code
 
validate(self, field_data, all_data)
Raises validators.ValidationError if field_data has any errors.
source code
 
set_attributes_from_name(self, name) source code
 
contribute_to_class(self, cls, name) source code
 
get_attname(self) source code
 
get_attname_column(self) source code
 
get_cache_name(self) source code
 
get_internal_type(self) source code
 
pre_save(self, model_instance, add)
Returns field's value just before saving.
source code
 
get_db_prep_save(self, value)
Returns field's value prepared for saving into a database.
source code
 
get_db_prep_lookup(self, lookup_type, value)
Returns field's value prepared for database lookup.
source code
 
has_default(self)
Returns a boolean of whether this field has a default value.
source code
 
get_default(self)
Returns the default value for this field.
source code
 
get_manipulator_field_names(self, name_prefix)
Returns a list of field names that this object adds to the manipulator.
source code
 
prepare_field_objs_and_params(self, manipulator, name_prefix) source code
 
get_manipulator_fields(self, opts, manipulator, change, name_prefix='', rel=False, follow=True)
Returns a list of oldforms.FormField instances for this field.
source code
 
get_validator_unique_lookup_type(self) source code
 
get_manipulator_new_data(self, new_data, rel=False)
Given the full new_data dictionary (from the manipulator), returns this field's data.
source code
 
get_choices(self, include_blank=True, blank_choice=BLANK_CHOICE_DASH)
Returns a list of tuples used as SelectField choices for this field.
source code
 
get_choices_default(self) source code
 
_get_val_from_obj(self, obj) source code
 
flatten_data(self, follow, obj=None)
Returns a dictionary mapping the field's manipulator field names to its "flattened" string values for the admin view.
source code
 
get_follow(self, override=None) source code
 
bind(self, fieldmapping, original, bound_field_class) source code
 
_get_choices(self) source code
 
choices(self) source code
 
save_form_data(self, instance, data) source code
 
formfield(self, form_class=forms.CharField, **kwargs)
Returns a django.newforms.Field instance for this database Field.
source code
 
value_from_object(self, obj)
Returns the value of this field in the given model instance.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  __metaclass__ = LegacyMaxlength
  empty_strings_allowed = True
  creation_counter = 0
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, core=False, rel=None, default=NOT_PROVIDED, editable=True, serialize=True, prepopulate_from=None, unique_for_date=None, unique_for_month=None, unique_for_year=None, validator_list=None, choices=None, radio_admin=None, help_text='', db_column=None, db_tablespace=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

to_python(self, value)

source code 

Converts the input value into the expected Python data type, raising validators.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this.

validate_full(self, field_data, all_data)

source code 

Returns a list of errors for this field. This is the main interface, as it encapsulates some basic validation logic used by all fields. Subclasses should implement validate(), not validate_full().

validate(self, field_data, all_data)

source code 

Raises validators.ValidationError if field_data has any errors. Subclasses should override this to specify field-specific validation logic. This method should assume field_data has already been converted into the appropriate data type by Field.to_python().

get_manipulator_fields(self, opts, manipulator, change, name_prefix='', rel=False, follow=True)

source code 

Returns a list of oldforms.FormField instances for this field. It calculates the choices at runtime, not at compile time.

name_prefix is a prefix to prepend to the "field_name" argument. rel is a boolean specifying whether this field is in a related context.

flatten_data(self, follow, obj=None)

source code 

Returns a dictionary mapping the field's manipulator field names to its "flattened" string values for the admin view. obj is the instance to extract the values from.