X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/1324f9b1e4d57c5ab50bc264507f7adc3207eb99..0959d38b27c03863ec376839dcc6d896d04e36ea:/philo/templatetags/collections.py diff --git a/philo/templatetags/collections.py b/philo/templatetags/collections.py index 62d6138..414a742 100644 --- a/philo/templatetags/collections.py +++ b/philo/templatetags/collections.py @@ -1,17 +1,6 @@ """ The collection template tags are automatically included as builtins if :mod:`philo` is an installed app. -.. templatetag:: membersof - -membersof ---------- - -Given a collection and a content type, sets the results of :meth:`collection.members.with_model <.CollectionMemberManager.with_model>` as a variable in the context. - -Usage:: - - {% membersof with . as %} - """ from django import template @@ -37,9 +26,14 @@ class MembersofNode(template.Node): return '' -def do_membersof(parser, token): +@register.tag +def membersof(parser, token): """ - {% membersof with . as %} + Given a collection and a content type, sets the results of :meth:`collection.members.with_model <.CollectionMemberManager.with_model>` as a variable in the context. + + Usage:: + + {% membersof with . as %} """ params=token.split_contents() @@ -62,7 +56,4 @@ def do_membersof(parser, token): if params[4] != 'as': raise template.TemplateSyntaxError('"%s" template tag requires the fifth parameter to be "as"' % tag) - return MembersofNode(collection=params[1], model=ct.model_class(), as_var=params[5]) - - -register.tag('membersof', do_membersof) \ No newline at end of file + return MembersofNode(collection=params[1], model=ct.model_class(), as_var=params[5]) \ No newline at end of file