def __init__(self, *args, **kw):
super(RegisterSpeaker, self).__init__(*args, **kw)
+ self.started = getattr(settings, 'REGISTRATION_SPEAKER_STARTED', False)
self.closed = getattr(settings, 'REGISTRATION_SPEAKER_CLOSED', False)
self.fields.keyOrder = [
'first_name',
--- /dev/null
+# -*- coding: utf-8 -*-
+from django.core.urlresolvers import reverse
+from .contact_forms import RegisterSpeaker
+
+
+def registration_url(request):
+ speaker_form = RegisterSpeaker()
+ if speaker_form.started and not speaker_form.closed:
+ url = reverse("contact_form", args=["register-speaker"])
+ else:
+ url = reverse("contact_form", args=["register"])
+ return {'REGISTRATION_URL': url}
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
'django.core.context_processors.request',
+ 'prawokultury.context_processors.registration_url',
)
{% endblock %}
<li id="item-lang">{% lang_switcher %}</li>
</ul>
- <a href="{% url "contact_form" "register-speaker" %}" style="float: right; margin: 0 10px; width: 220px; text-align:center; background: #ED7F00; color: white; font-size: 24px; text-transform: uppercase;">{% trans "Registration" %}</a>
+ <a href="{{ REGISTRATION_URL }}" style="float: right; margin: 0 10px; width: 220px; text-align:center; background: #ED7F00; color: white; font-size: 24px; text-transform: uppercase;">{% trans "Registration" %}</a>
<div style="clear: both;"></div>
</div>