equal
deleted
inserted
replaced
57 """ |
57 """ |
58 |
58 |
59 logout(request) |
59 logout(request) |
60 return redirect('/reg') |
60 return redirect('/reg') |
61 |
61 |
62 def user_register(request): |
62 def user_register(request, event_key): |
63 """ take the credentials like name, college and gender here itself. |
63 """ take the credentials like name, college and gender here itself. |
64 """ |
64 """ |
|
65 |
|
66 if event_key: |
|
67 try: |
|
68 event = Event.objects.get(key=event_key) |
|
69 except Event.DoesNotExist: |
|
70 raise Http404 |
|
71 |
|
72 if not event.registration_is_open: |
|
73 raise Http404 |
65 |
74 |
66 if request.method == "POST": |
75 if request.method == "POST": |
67 form = reg_forms.RegisterForm(request.POST) |
76 form = reg_forms.RegisterForm(request.POST) |
68 if form.is_valid(): |
77 if form.is_valid(): |
69 data = form.cleaned_data |
78 data = form.cleaned_data |
74 gender=data['gender'], |
83 gender=data['gender'], |
75 profession=data['profession'], |
84 profession=data['profession'], |
76 affiliated_to=data['affiliated_to'], |
85 affiliated_to=data['affiliated_to'], |
77 interests=data['interests'] |
86 interests=data['interests'] |
78 ) |
87 ) |
|
88 |
79 reg_events.send_activation(new_user) |
89 reg_events.send_activation(new_user) |
|
90 if event_key: |
|
91 event.attendees.add(new_user) |
|
92 event.save() |
|
93 |
80 return redirect('/reg/account_created') |
94 return redirect('/reg/account_created') |
81 else: |
95 else: |
82 return render_to_response('register.html', {'form':form}) |
96 return render_to_response('register.html', {'form':form}) |
83 else: |
97 else: |
84 form = reg_forms.RegisterForm() |
98 form = reg_forms.RegisterForm() |