now after registration, user is also added to corresponding workshop .
--- a/reg/events.py Thu Apr 15 14:50:47 2010 +0530
+++ b/reg/events.py Thu Apr 15 15:10:31 2010 +0530
@@ -110,4 +110,3 @@
profile.save()
-
--- a/reg/site/urls.py Thu Apr 15 14:50:47 2010 +0530
+++ b/reg/site/urls.py Thu Apr 15 15:10:31 2010 +0530
@@ -6,7 +6,7 @@
(r'^$', reg_views.homepage),
(r'^login/$', reg_views.user_login),
(r'^logout/$', reg_views.user_logout),
- (r'^register/$', reg_views.user_register),
+ (r'^register/(\w+)$', reg_views.user_register),
(r'^account_created/$', reg_views.account_created),
(r'^resend_activation/$', reg_views.resend_activation),
(r'^activate/(\w+)/$', reg_views.account_activate),
--- 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})