X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/cec32849d48d9e36c030224e2eb9631d31ef17a2..e96369a63407b44b8e363b057194a89dc4c5fd69:/docs/models/entities.rst?ds=inline diff --git a/docs/models/entities.rst b/docs/models/entities.rst index fee27c1..b39a253 100644 --- a/docs/models/entities.rst +++ b/docs/models/entities.rst @@ -1,72 +1,55 @@ Entities and Attributes ======================= -One of the core concepts in philo is the relationship between the :class:`Entity` and :class:`Attribute` classes. :class:`Attribute`\ s represent an arbitrary key/value pair by having one :class:`GenericForeignKey` to an :class:`Entity` and another to an :class:`AttributeValue`. +.. module:: philo.models.base -Functions ---------- +One of the core concepts in Philo is the relationship between the :class:`Entity` and :class:`Attribute` classes. :class:`Attribute`\ s represent an arbitrary key/value pair by having one :class:`GenericForeignKey` to an :class:`Entity` and another to an :class:`AttributeValue`. -.. function:: register_value_model(model) -.. function:: unregister_value_model(model) - Helper functions to register/unregister a model as a valid content type for a :class:`ForeignKeyValue` or :class:`ManyToManyValue`. +Attributes +---------- +.. autoclass:: Attribute + :members: -Classes -------- +.. autoclass:: AttributeValue + :members: -.. class:: AttributeValue +.. automodule:: philo.models.base + :noindex: + :members: attribute_value_limiter - This is an abstract base class for models that can be used as values for :class:`Attribute`\ s. See the code for examples of implementations. +.. autoclass:: JSONValue + :show-inheritance: - .. attribute:: attribute_set +.. autoclass:: ForeignKeyValue + :show-inheritance: - :class:`GenericRelation` back to :class:`Attribute` +.. autoclass:: ManyToManyValue + :show-inheritance: - .. method:: set_value(value) +.. automodule:: philo.models.base + :noindex: + :members: value_content_type_limiter - Interpret ``value`` and set the appropriate fields so that the value displayed to the world is equivalent to ``value``. +.. autofunction:: register_value_model(model) +.. autofunction:: unregister_value_model(model) - .. method:: value_formfields(**kwargs) +Entities +-------- - Define any formfields that would be used to construct an instance of this value. +.. autoclass:: Entity + :members: - .. method:: construct_instance(**kwargs) +.. autoclass:: TreeEntityManager + :members: - Apply cleaned data from the formfields generated by valid_formfields to oneself. +.. autoclass:: TreeEntity + :show-inheritance: + :members: -.. class:: Attribute + .. attribute:: objects - Represents an arbitrary key/value pair attached to a model. - - .. attribute:: entity - - :class:`GenericForeignKey` to anything. - - .. attribute:: value - - :class:`GenericForeignKey` to a subclass of :class:`AttributeValue`. - - .. attribute:: key - - :class:`CharField` containing a key (up to 255 characters) consisting of alphanumeric characters and underscores. - -.. class:: Entity - - A class that simplifies access to related attributes. - - .. attribute:: attribute_set - - :class:`GenericRelation` back to :class:`Attribute`. - - .. attribute:: attributes - - Property that returns a dictionary-like object which can be used to retrieve :class:`Attribute`\ s values directly. - - Example:: - - >>> attr = entity.attribute_set.get(key='spam') - >>> attr.value.value - u'eggs' - >>> entity.attributes['spam'] - u'eggs' \ No newline at end of file + An instance of :class:`TreeEntityManager`. + + .. automethod:: get_path \ No newline at end of file