fix condition for "remind me" button
[prawokultury.git] / prawokultury / context_processors.py
1 # -*- coding: utf-8 -*-
2 from django.core.urlresolvers import reverse
3 from django.utils.translation import ugettext as _
4
5 from prawokultury.contact_forms import RegistrationForm
6 from .contact_forms import RegisterSpeaker
7
8
9 def registration_url(request):
10     speaker_form = RegisterSpeaker()
11     registration_form = RegistrationForm()
12     if speaker_form.started and not speaker_form.closed:
13         url = reverse("contact_form", args=["register-speaker"])
14         label = _('Registration')
15     elif not speaker_form.started or (speaker_form.closed and not registration_form.started):
16         url = reverse("contact_form", args=["remind-me"])
17         label = _('Remind me')
18     else:
19         url = reverse("contact_form", args=["register"])
20         label = _('Registration')
21     return {'REGISTRATION_URL': url, 'REGISTRATION_BUTTON_LABEL': label}