ievv_tagframework — General purpose tagging framework¶
The intention of this module is to provide a re-usable tagging framework for Django apps.
Data model API¶
-
class
ievv_opensource.ievv_tagframework.models.Tag(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelA single tag.
A tag has a unique name, and data models is added to a tag via
TaggedObject.-
taglabel¶ The label for the tag.
-
tagtype¶ The tagtype is a way for applications to group tags by type. No logic is assigned to this field by default, other than that is is
db_indexed. The valid choices for the field is configured via theIEVV_TAGFRAMEWORK_TAGTYPE_CHOICESsetting.
-
static
get_tagtype_choices()[source]¶ Returns choices for
tagtype.This is not set as choices on the field (because changing that would trigger a migration), but it should be used in any form displaying tagtype.
You configure the return value via the
IEVV_TAGFRAMEWORK_TAGTYPE_CHOICESDjango setting.
-
classmethod
get_tagtype_valid_values()[source]¶ Returns an iterator over the choices returned by
get_tagtype_choices(), but only the values (not the labels) as a flat list.
-
clean()[source]¶ Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
-
exception
DoesNotExist¶
-
exception
MultipleObjectsReturned¶
-
-
class
ievv_opensource.ievv_tagframework.models.TaggedObject(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelRepresents a many-to-many relationship between any data model object and a
Tag.-
content_type¶ The ContentType of the tagged object.
-
object_id¶ The ID of the tagged object.
-
content_object¶ The GenericForeignKey using
content_typeandobject_idto create a generic foreign key to the tagged object.
-
exception
DoesNotExist¶
-
exception
MultipleObjectsReturned¶
-