diff -r 7d748db0c7c3 -r b66d405eb8c7 reg/views.py --- a/reg/views.py Thu Apr 15 14:50:47 2010 +0530 +++ b/reg/views.py Thu Apr 15 15:10:31 2010 +0530 @@ -59,10 +59,19 @@ logout(request) return redirect('/reg') -def user_register(request): +def user_register(request, event_key): """ take the credentials like name, college and gender here itself. """ + if event_key: + try: + event = Event.objects.get(key=event_key) + except Event.DoesNotExist: + raise Http404 + + if not event.registration_is_open: + raise Http404 + if request.method == "POST": form = reg_forms.RegisterForm(request.POST) if form.is_valid(): @@ -76,7 +85,12 @@ affiliated_to=data['affiliated_to'], interests=data['interests'] ) + reg_events.send_activation(new_user) + if event_key: + event.attendees.add(new_user) + event.save() + return redirect('/reg/account_created') else: return render_to_response('register.html', {'form':form})