Commit 3d5b1d68 authored by Luuk Scholten's avatar Luuk Scholten
Browse files

Merge branch '346-register-before-fields' into 'master'

Create registration before fields are filled in

Closes #346

See merge request !477
parents 7857a9e0 7315f7c6
......@@ -261,7 +261,7 @@ class RegistrationTest(TestCase):
self.assertEqual(field2.get_value_for(registration), 42)
self.assertEqual(field3.get_value_for(registration), 'text')
def test_registration_register_field_required(self):
def test_registration_register_fields_not_required(self):
self.event.registration_start = (timezone.now() -
datetime.timedelta(hours=1))
self.event.registration_end = (timezone.now() +
......@@ -283,22 +283,6 @@ class RegistrationTest(TestCase):
self.assertEqual(response.status_code, 200)
template_names = [template.name for template in response.templates]
self.assertIn('events/event_fields.html', template_names)
self.assertEqual(self.event.num_participants(), 0)
# This is wrong
response = self.client.post('/events/1/registration/register/',
{'test': 'test',
'csrf': 'token'},
follow=True)
self.assertEqual(response.status_code, 200)
self.assertEqual(self.event.num_participants(), 0)
# This is correct
response = self.client.post('/events/1/registration/register/',
{'info_field_1': 'test',
'csrf': 'token'},
follow=True)
self.assertEqual(response.status_code, 200)
self.assertEqual(self.event.num_participants(), 1)
def test_registration_update_form_load_not_changes_fields(self):
......
......@@ -258,10 +258,9 @@ def _registration_register(request, event, reg):
reg.event = event
reg.member = request.user.member
messages.success(request, _("Registration successful."))
reg.save()
if event.has_fields():
return _show_registration_fields(request, event, reg, 'register')
else:
reg.save()
elif reg.date_cancelled is not None:
if reg.is_late_cancellation():
messages.error(request, _("You cannot re-register anymore since "
......@@ -270,11 +269,10 @@ def _registration_register(request, event, reg):
reg.date = timezone.now()
reg.date_cancelled = None
messages.success(request, _("Registration successful."))
reg.save()
if event.has_fields():
return _show_registration_fields(request, event, reg,
'register')
else:
reg.save()
elif not reg.member.can_attend_events:
messages.error(request, _("You may not register"))
else:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment