categories.models.CategoryRelation
CategoryRelation#
- class categories.models.CategoryRelation(*args, **kwargs)[source]#
Related category item.
- Parameters:
id (AutoField) – Primary key: ID
object_id (PositiveIntegerField) – Object id
relation_type (CharField) – Relation type. A generic text field to tag a relation, like ‘leadphoto’.
content_object (GenericForeignKey) – Generic foreign key to the
ContentTypespecified incontent_type
Relationship fields:
- Parameters:
category (
ForeignKeytoCategory) – Category (related name:categoryrelation)content_type (
ForeignKeytoContentType) – Content type (related name:categoryrelation)
Methods
check(**kwargs)clean()Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields.
clean_fields([exclude])Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
date_error_message(lookup_type, field_name, ...)delete([using, keep_parents])from_db(db, field_names, values)full_clean([exclude, validate_unique])Call clean_fields(), clean(), and validate_unique() on the model.
get_deferred_fields()Return a set containing names of deferred fields for this instance.
prepare_database_save(field)refresh_from_db([using, fields])Reload field values from the database.
save([force_insert, force_update, using, ...])Save the current instance.
save_base([raw, force_insert, force_update, ...])Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too.
serializable_value(field_name)Return the value of the field name for this instance.
unique_error_message(model_class, unique_check)validate_unique([exclude])Check unique constraints on the model and raise ValidationError if any failed.
Attributes
categoryType:
ForeignKeytoCategorycategory_idInternal field, use
categoryinstead.content_objectProvide a generic many-to-one relation through the
content_typeandobject_idfields.content_typeType:
ForeignKeytoContentTypecontent_type_idInternal field, use
content_typeinstead.idType:
AutoFieldobject_idType:
PositiveIntegerFieldobjectspkrelation_typeType:
CharField