Commit d64a32bd by Alex Gaynor

Provide docs.

parent d133ea62
...@@ -4,7 +4,13 @@ The API ...@@ -4,7 +4,13 @@ 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 .. class:: TaggableManager([verbose_name="Tags", help_text="A comma-separated list of tags.", through=None, blank=False])
:param verbose_name: The verbose_name for this field.
:param help_text: The help_text to be used in forms (including the admin).
:param through: The through model, see :doc:`custom_tagging` for more
information.
:param blank: Controls whether this field is required.
.. method:: add(*tags) .. method:: add(*tags)
......
Changelog Changelog
========= =========
1.0.0
~~~~~
Unreleased.
* *Backwards incompatible* Forms containing a :class:`TaggableManager` by
default now require tags, to change this provide ``blank=True`` to the
:class:`TaggableManager`.
0.9.0 0.9.0
~~~~~ ~~~~~
......
...@@ -36,13 +36,13 @@ class TaggableRel(ManyToManyRel): ...@@ -36,13 +36,13 @@ class TaggableRel(ManyToManyRel):
class TaggableManager(RelatedField): class TaggableManager(RelatedField):
def __init__(self, verbose_name=_("Tags"), help_text=None, through=None, def __init__(self, verbose_name=_("Tags"),
blank=False): help_text=_("A comma-separated list of tags."), through=None, blank=False):
self.use_gfk = through is None or issubclass(through, GenericTaggedItemBase) self.use_gfk = through is None or issubclass(through, GenericTaggedItemBase)
self.through = through or TaggedItem self.through = through or TaggedItem
self.rel = TaggableRel(to=self.through._meta.get_field("tag").rel.to) self.rel = TaggableRel(to=self.through._meta.get_field("tag").rel.to)
self.verbose_name = verbose_name self.verbose_name = verbose_name
self.help_text = help_text or _("A comma-separated list of tags.") self.help_text = help_text
self.blank = blank self.blank = blank
self.editable = True self.editable = True
self.unique = False self.unique = False
......
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