X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/feec5e756a0f6b869fcf87d05e3415f6e319d041..e81bcde0df7337d96bebf09256f675b427d673bb:/philo/models/base.py?ds=inline diff --git a/philo/models/base.py b/philo/models/base.py index 8df67c3..8aef89a 100644 --- a/philo/models/base.py +++ b/philo/models/base.py @@ -16,23 +16,7 @@ from philo.utils.entities import AttributeMapper, TreeAttributeMapper from philo.validators import json_validator -__all__ = ('Tag', 'value_content_type_limiter', 'register_value_model', 'unregister_value_model', 'JSONValue', 'ForeignKeyValue', 'ManyToManyValue', 'Attribute', 'Entity', 'TreeEntity', 'SlugTreeEntity') - - -class Tag(models.Model): - """A simple, generic model for tagging.""" - #: A CharField (max length 255) which contains the name of the tag. - name = models.CharField(max_length=255) - #: A CharField (max length 255) which contains the tag's unique slug. - slug = models.SlugField(max_length=255, unique=True) - - def __unicode__(self): - """Returns the value of the :attr:`name` field""" - return self.name - - class Meta: - app_label = 'philo' - ordering = ('name',) +__all__ = ('value_content_type_limiter', 'register_value_model', 'unregister_value_model', 'JSONValue', 'ForeignKeyValue', 'ManyToManyValue', 'Attribute', 'Entity', 'TreeEntity', 'SlugTreeEntity') #: An instance of :class:`.ContentTypeRegistryLimiter` which is used to track the content types which can be related to by :class:`ForeignKeyValue`\ s and :class:`ManyToManyValue`\ s. @@ -44,9 +28,6 @@ def register_value_model(model): value_content_type_limiter.register_class(model) -register_value_model(Tag) - - def unregister_value_model(model): """Registers a model as a valid content type for a :class:`ForeignKeyValue` or :class:`ManyToManyValue` through the :data:`value_content_type_limiter`.""" value_content_type_limiter.unregister_class(model) @@ -303,7 +284,7 @@ class Entity(models.Model): """An abstract class that simplifies access to related attributes. Most models provided by Philo subclass Entity.""" __metaclass__ = EntityBase - attribute_set = generic.GenericRelation(Attribute, content_type_field='entity_content_type', object_id_field='entity_object_id') + attribute_set = generic.GenericRelation(Attribute, content_type_field='entity_content_type', object_id_field='entity_object_id', related_name='%(app_label)s_%(class)s_set') def get_attribute_mapper(self, mapper=AttributeMapper): """