from django import template

from ..forms import WaitingListEntryForm


register = template.Library()


@register.assignment_tag
def waitinglist_entry_form():
    """
    Get a (new) form object to post a new comment.

    Syntax::

        {% waitinglist_entry_form as [varname] %}

    """
    return WaitingListEntryForm()

@@ -111,22 +111,38 @@
 ter.
-assignment_tag
+simple_tag(takes_context=True)
 %0Adef
@@ -165,16 +165,23 @@
 ry_form(
+context
 ):%0A    %22
@@ -304,24 +304,241 @@
 %25%7D%0A%0A    %22%22%22%0A
+    initial = %7B%7D%0A    if %22request%22 in context:%0A        initial.update(%7B%0A            %22referrer%22: context%5B%22request%22%5D.META.get(%22HTTP_REFERER%22, %22%22),%0A            %22campaign%22: context%5B%22request%22%5D.GET.get(%22wlc%22, %22%22)%0A        %7D)%0A
     return W
@@ -557,10 +557,25 @@
 tryForm(
+initial=initial
 )%0A

Update template tag to also take context