Skip to content
Browse files

simplified {% waitinglist_entry_form %} with assignment_tag

  • Loading branch information...
1 parent 2d5a1f4 commit 61e69d0abf24988d9a34dc59dabca1478a3ffdc1 @brosner brosner committed Apr 14, 2012
Showing with 3 additions and 19 deletions.
  1. +3 −19 waitinglist/templatetags/waitinglist_tags.py
View
22 waitinglist/templatetags/waitinglist_tags.py
@@ -6,21 +6,8 @@
register = template.Library()
-class WaitingListEntryFormNode(template.Node):
-
- def __init__(self, as_varname):
- self.as_varname = as_varname
-
- def get_form(self, context):
- return WaitingListEntryForm()
-
- def render(self, context):
- context[self.as_varname] = self.get_form(context)
- return ""
-
-
-@register.tag
-def waitinglist_entry_form(parser, token):
+@register.assignment_tag
+def waitinglist_entry_form():
"""
Get a (new) form object to post a new comment.
@@ -29,7 +16,4 @@ def waitinglist_entry_form(parser, token):
{% waitinglist_entry_form as [varname] %}
"""
- bits = token.split_contents()
- if len(bits) != 3:
- raise template.TemplateSyntaxError("'%s' takes one 'as' argument" % bits[0])
- return WaitingListEntryFormNode(bits[2])
+ return WaitingListEntryForm()

0 comments on commit 61e69d0

Please sign in to comment.
Something went wrong with that request. Please try again.