categories.fields.CategoryM2MField

CategoryM2MField#

class categories.fields.CategoryM2MField(**kwargs)[source]#

A many to many field to a 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, **kwargs)

Register the field with the model class it belongs to.

contribute_to_related_class(cls, related)

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_to to 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 default value for this field.

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_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_internal_type()

get_limit_choices_to()

Return limit_choices_to for this model field.

get_lookup(lookup_name)

get_lookups()

get_path_info([filtered_relation])

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_path_info([filtered_relation])

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.

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_counter

cached_col

class_lookups

creation_counter

db_returning

Private API intended only to be used by Django itself.

db_tablespace

default_error_messages

default_validators

description

empty_strings_allowed

empty_values

flatchoices

Flattened version of choices tuple.

hidden

many_to_many

many_to_one

one_to_many

one_to_one

related_model

swappable_setting

Get the setting that this is powered from for swapping, or None if it's not swapped in / marked with swappable=False.

system_check_deprecated_details

system_check_removed_details

target_field

When filtering against this relation, return the field on the remote model against which the filtering should happen.

unique

validators

Some validators can't be created at field initialization time.