registration for workshop is now integrated with man registartion.
authornishanth
Thu, 15 Apr 2010 15:51:16 +0530
changeset 46 ff5f34e42aec
parent 45 b66d405eb8c7
child 47 e1895d2ede97
registration for workshop is now integrated with man registartion.
reg/events.py
reg/site/urls.py
reg/views.py
templates/account_activated.html
templates/account_created.html
templates/register.html
templates/sent_activationkey.html
templates/view_event.html
--- a/reg/events.py	Thu Apr 15 15:10:31 2010 +0530
+++ b/reg/events.py	Thu Apr 15 15:51:16 2010 +0530
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 
 from django.contrib.auth.models import User
-
+from django.core.mail import send_mail
 from django.db import IntegrityError
 
 from workshop.reg.models import Profile, Event
--- a/reg/site/urls.py	Thu Apr 15 15:10:31 2010 +0530
+++ b/reg/site/urls.py	Thu Apr 15 15:51:16 2010 +0530
@@ -6,7 +6,7 @@
     (r'^$', reg_views.homepage),
     (r'^login/$', reg_views.user_login),
     (r'^logout/$', reg_views.user_logout),
-    (r'^register/(\w+)$', 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 15:10:31 2010 +0530
+++ b/reg/views.py	Thu Apr 15 15:51:16 2010 +0530
@@ -69,8 +69,10 @@
         except Event.DoesNotExist:
             raise Http404
 
-    if not event.registration_is_open:
-        raise Http404
+        if not event.registration_is_open:
+            raise Http404
+    else:
+        event = None
 
     if request.method == "POST":
         form = reg_forms.RegisterForm(request.POST)
@@ -87,16 +89,16 @@
                                              )
 
             reg_events.send_activation(new_user)
-            if event_key:
+            if event:
                 event.attendees.add(new_user)
                 event.save()
 
             return redirect('/reg/account_created')
         else:
-            return render_to_response('register.html', {'form':form})
+            return render_to_response('register.html', {'form':form, 'event':event})
     else:
         form = reg_forms.RegisterForm()
-        return render_to_response('register.html', {'form':form})
+        return render_to_response('register.html', {'form':form, 'event':event})
 
 def account_created(request):
     """ simply display a page.
--- a/templates/account_activated.html	Thu Apr 15 15:10:31 2010 +0530
+++ b/templates/account_activated.html	Thu Apr 15 15:51:16 2010 +0530
@@ -1,4 +1,4 @@
 {% extends "base.html" %}
 {% block content %}
-Your account has been activated.
+Your account has been activated and your registration has been confirmed.
 {% endblock %}
--- a/templates/account_created.html	Thu Apr 15 15:10:31 2010 +0530
+++ b/templates/account_created.html	Thu Apr 15 15:51:16 2010 +0530
@@ -1,5 +1,5 @@
 {% extends "base.html" %}
 {% block content %}
 Account has been created and an activation email has been sent to your email address.<br />
-<a href="/reg/login">click here</a> to go to login page.
+Please activate your account to confirm the registration.
 {% endblock %}
--- a/templates/register.html	Thu Apr 15 15:10:31 2010 +0530
+++ b/templates/register.html	Thu Apr 15 15:51:16 2010 +0530
@@ -1,5 +1,8 @@
 {% extends "base.html" %}
 {% block content %}
+{% if event %}
+	Register for workshop {{event.title}} to be conducted at {{event.venue}}<br />
+{% endif %}
 <form action="" method="post">
 {{ form.as_p }}
 <input type="submit" value="submit">
--- a/templates/sent_activationkey.html	Thu Apr 15 15:10:31 2010 +0530
+++ b/templates/sent_activationkey.html	Thu Apr 15 15:51:16 2010 +0530
@@ -1,5 +1,4 @@
 {% extends "base.html" %}
 {% block content %}
 Activation email has been sent to your email address.<br />
-<a href="/reg">click here</a> to go to home page.
 {% endblock %}
--- a/templates/view_event.html	Thu Apr 15 15:10:31 2010 +0530
+++ b/templates/view_event.html	Thu Apr 15 15:51:16 2010 +0530
@@ -17,7 +17,7 @@
 			Registration for this workshop is not open at this moment.<br />
 		{% endif %}
 	{% else %}
-		You must be a registered user to register for this workshop.<br />
+		<a href="/reg/register/{{event.key}}">Register for this workshop</a>.<br />
 	{% endif %}
 	
 	{% if can_submit_feedback %}