Commit c6eb0581 by Alex Gaynor

Clean up the formatting of the docs

parent 7091e95a
...@@ -4,53 +4,49 @@ The API ...@@ -4,53 +4,49 @@ The API
After you've got your ``TaggableManager`` added to your model you can start After you've got your ``TaggableManager`` added to your model you can start
playing around with the API. playing around with the API.
.. class:: TaggableManager
add(*tags) .. method:: add(*tags)
~~~~~~~~~~
This adds tags to an object. The tags can be either ``Tag`` instances, or This adds tags to an object. The tags can be either ``Tag`` instances, or
strings:: strings::
>>> apple.tags.all() >>> apple.tags.all()
[] []
>>> apple.tags.add("red", "green", "fruit") >>> apple.tags.add("red", "green", "fruit")
.. method:: remove(*tags)
remove(*tags) Removes a tag from an object. No exception is raised if the object
~~~~~~~~~~~~~ doesn't have that tag.
Removes a tag from an object. No exception is raised if the object doesn't have .. method:: clear()
that tag.
clear() Removes all tags from an object.
~~~~~~~
Removes all tags from an object. .. method:: set(*tags)
set(*tags) Removes all the current tags and then adds the specified tags to the
~~~~~~~~~~ object.
Removes all the current tags and then adds the specified tags to the object. .. method: most_common()
most_common() Returns a ``QuerySet`` of all tags, annotated with the number of times
~~~~~~~~~~~~~ they appear, available as the ``num_times`` attribute on each tag. The
``QuerySet``is ordered by ``num_times``, descending. The ``QuerySet``
is lazily evaluated, and can be sliced efficiently.
Returns a ``QuerySet`` of all tags, annotated with the number of times they .. method:: similar_objects()
appear, available as the ``num_times`` attribute on each tag. The ``QuerySet``
is ordered by ``num_times``, descending. The ``QuerySet`` is lazily evaluated,
and can be sliced efficiently.
similar_objects() Returns a list (not a lazy ``QuerySet``) of other objects tagged
~~~~~~~~~~~~~~~~~ similarly to this one, ordered with most similar first. Each object in
the list is decorated with a ``similar_tags`` attribute, the number of
tags it shares with this object.
Returns a list (not a lazy ``QuerySet``) of other objects tagged similarly to If the model is using generic tagging (the default), this method
this one, ordered with most similar first. Each object in the list is decorated searches tagged objects from all classes. If you are querying on a
with a ``similar_tags`` attribute, the number of tags it shares with this model with its own tagging through table, only other instances of the
object. same model will be returned.
If using generic tagging (the default), this method searches all tagged
objects. If querying on a model with its own tagging through table, only other
instances of the same model will be returned.
Filtering Filtering
~~~~~~~~~ ~~~~~~~~~
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment