Commit 73c6fad4 by Gert Van Gool

Added support for help_text and use the provided verbose_name and help_text in the formfield

parent e58d81e0
......@@ -36,11 +36,12 @@ class TaggableRel(ManyToManyRel):
class TaggableManager(RelatedField):
def __init__(self, verbose_name=_("Tags"), through=None):
def __init__(self, verbose_name=_("Tags"), help_text=None, through=None):
self.use_gfk = through is None or issubclass(through, GenericTaggedItemBase)
self.through = through or TaggedItem
self.rel = TaggableRel(to=self.through._meta.get_field("tag").rel.to)
self.verbose_name = verbose_name
self.help_text = help_text or _("A comma-separated list of tags.")
self.editable = True
self.unique = False
self.creates_table = False
......@@ -74,8 +75,8 @@ class TaggableManager(RelatedField):
def formfield(self, form_class=TagField, **kwargs):
defaults = {
"label": _("Tags"),
"help_text": _("A comma-separated list of tags.")
"label": self.verbose_name,
"help_text": self.help_text,
}
defaults.update(kwargs)
return form_class(**defaults)
......
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