equal
deleted
inserted
replaced
67 try: |
67 try: |
68 event = Event.objects.get(key=event_key) |
68 event = Event.objects.get(key=event_key) |
69 except Event.DoesNotExist: |
69 except Event.DoesNotExist: |
70 raise Http404 |
70 raise Http404 |
71 |
71 |
72 if not event.registration_is_open: |
72 if not event.registration_is_open: |
73 raise Http404 |
73 raise Http404 |
|
74 else: |
|
75 event = None |
74 |
76 |
75 if request.method == "POST": |
77 if request.method == "POST": |
76 form = reg_forms.RegisterForm(request.POST) |
78 form = reg_forms.RegisterForm(request.POST) |
77 if form.is_valid(): |
79 if form.is_valid(): |
78 data = form.cleaned_data |
80 data = form.cleaned_data |
85 affiliated_to=data['affiliated_to'], |
87 affiliated_to=data['affiliated_to'], |
86 interests=data['interests'] |
88 interests=data['interests'] |
87 ) |
89 ) |
88 |
90 |
89 reg_events.send_activation(new_user) |
91 reg_events.send_activation(new_user) |
90 if event_key: |
92 if event: |
91 event.attendees.add(new_user) |
93 event.attendees.add(new_user) |
92 event.save() |
94 event.save() |
93 |
95 |
94 return redirect('/reg/account_created') |
96 return redirect('/reg/account_created') |
95 else: |
97 else: |
96 return render_to_response('register.html', {'form':form}) |
98 return render_to_response('register.html', {'form':form, 'event':event}) |
97 else: |
99 else: |
98 form = reg_forms.RegisterForm() |
100 form = reg_forms.RegisterForm() |
99 return render_to_response('register.html', {'form':form}) |
101 return render_to_response('register.html', {'form':form, 'event':event}) |
100 |
102 |
101 def account_created(request): |
103 def account_created(request): |
102 """ simply display a page. |
104 """ simply display a page. |
103 """ |
105 """ |
104 |
106 |