categories.fields.CategoryFKField
CategoryFKField#
- class categories.fields.CategoryFKField(**kwargs)[source]#
A foreign key to the Category model.
Methods
cast_db_type(connection)Return the data type to use in the Cast() function.
check(**kwargs)clean(value, model_instance)Convert the value's type and run validation.
clone()Uses deconstruct() to clone a new copy of this Field.
contribute_to_class(cls, name[, private_only])Register the field with the model class it belongs to.
contribute_to_related_class(cls, related)convert_empty_strings(value, expression, ...)db_check(connection)Return the database column check constraint for this field, for the provided connection.
db_parameters(connection)Extension of db_type(), providing a range of different return values (type, checks).
db_type(connection)Return the database column data type for this field, for the provided connection.
db_type_parameters(connection)db_type_suffix(connection)deconstruct()Return enough information to recreate the field as a 4-tuple:
delete_cached_value(instance)do_related_class(other, cls)formfield(*[, using])Pass
limit_choices_toto the field being constructed.get_attname()get_attname_column()get_cache_name()get_cached_value(instance[, default])get_choices([include_blank, blank_choice, ...])Return choices with a default blank choices included, for use as <select> choices for this field.
get_col(alias[, output_field])get_db_converters(connection)get_db_prep_save(value, connection)Return field's value prepared for saving into a database.
get_db_prep_value(value, connection[, prepared])Return field's value prepared for interacting with the database backend.
get_default()Return the to_field if the default value is an object.
get_extra_descriptor_filter(instance)Return an extra filter condition for related object fetching when user does 'instance.fieldname', that is the extra filter is used in the descriptor of the field.
get_extra_restriction(where_class, alias, ...)Return a pair condition used for joining and subquery pushdown.
get_filter_kwargs_for_object(obj)Return a dict that when passed as kwargs to self.model.filter(), would yield all instances having the same value for this field as obj has.
get_foreign_related_value(instance)get_forward_related_filter(obj)Return the keyword arguments that when supplied to self.model.object.filter(), would select all instances related through this field to the remote obj.
get_instance_value_for_fields(instance, fields)get_internal_type()get_joining_columns([reverse_join])get_limit_choices_to()Return
limit_choices_tofor this model field.get_local_related_value(instance)get_lookup(lookup_name)get_lookups()get_path_info([filtered_relation])Get path from this field to the related model.
get_pk_value_on_save(instance)Hook to generate new PK values on save.
get_prep_value(value)Perform preliminary non-db specific value checks and conversions.
get_reverse_joining_columns()get_reverse_path_info([filtered_relation])Get path from the related model to this field's model.
get_reverse_related_filter(obj)Complement to get_forward_related_filter().
get_transform(lookup_name)has_default()Return a boolean of whether this field has a default value.
is_cached(instance)merge_dicts(dicts)Merge dicts in reverse to preference the order of the original list.
pre_save(model_instance, add)Return field's value just before saving.
register_lookup(lookup[, lookup_name])rel_db_type(connection)Return the data type that a related field pointing to this field should use.
related_query_name()Define the name that can be used to identify this related object in a table-spanning query.
resolve_related_fields()run_validators(value)save_form_data(instance, data)select_format(compiler, sql, params)Custom format for select clauses.
set_attributes_from_name(name)set_attributes_from_rel()set_cached_value(instance, value)to_python(value)Convert the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted.
validate(value, model_instance)Validate value and raise ValidationError if necessary.
value_from_object(obj)Return the value of this field in the given model instance.
value_to_string(obj)Return a string value of this field from the passed obj.
Attributes
auto_creation_countercached_colclass_lookupscreation_counterdb_returningPrivate API intended only to be used by Django itself.
db_tablespacedefault_error_messagesdefault_validatorsdescriptionempty_strings_allowedempty_valuesflatchoicesFlattened version of choices tuple.
foreign_related_fieldshiddenlocal_related_fieldsmany_to_manymany_to_oneone_to_manyone_to_onerelated_fieldsrelated_modelrequires_unique_targetreverse_related_fieldsswappable_settingGet the setting that this is powered from for swapping, or None if it's not swapped in / marked with swappable=False.
system_check_deprecated_detailssystem_check_removed_detailstarget_fieldWhen filtering against this relation, return the field on the remote model against which the filtering should happen.
uniquevalidatorsSome validators can't be created at field initialization time.