added closing registration and registering for a workshop .
--- a/reg/site/urls.py Mon Apr 12 12:08:19 2010 +0530
+++ b/reg/site/urls.py Mon Apr 12 12:32:46 2010 +0530
@@ -11,6 +11,8 @@
(r'^password_change/$', reg_views.change_password),
(r'^event/create/$', reg_views.create_event),
(r'^event/view/(\w+)/$', reg_views.view_event),
- (r'^event/feedback/open/(\w+)', reg_views.open_feedback),
- (r'^event/feedback/close/(\w+)', reg_views.close_feedback),
+ (r'^event/feedback/open/(\w+)/$', reg_views.open_feedback),
+ (r'^event/feedback/close/(\w+)/$', reg_views.close_feedback),
+ (r'^event/registration/open/(\w+)/$', reg_views.open_registration),
+ (r'^event/registration/close/(\w+)/$', reg_views.close_registration),
)
--- a/reg/views.py Mon Apr 12 12:08:19 2010 +0530
+++ b/reg/views.py Mon Apr 12 12:32:46 2010 +0530
@@ -229,3 +229,60 @@
else:
return redirect('/reg')
+def open_registration(request, event_key):
+ """ simply check for is_org and then set the registration_is_open flag.
+ """
+
+ user = request.user
+ try:
+ event = Event.objects.get(key__iexact=event_key)
+ except Event.DoesNotExist:
+ return redirect("/reg")
+
+ is_org = True if user in event.organizers.all() else False
+
+ if is_org:
+ event.registration_is_open = True
+ event.save()
+ return render_to_response('reg_open.html', {'event': event})
+ else:
+ return redirect('/reg')
+
+def close_registration(request, event_key):
+ """ simply check for is_org and then unset the registration_is_open flag.
+ """
+
+ user = request.user
+ try:
+ event = Event.objects.get(key__iexact=event_key)
+ except Event.DoesNotExist:
+ return redirect("/reg")
+
+ is_org = True if user in event.organizers.all() else False
+
+ if is_org:
+ event.registration_is_open = False
+ event.save()
+ return render_to_response('reg_close.html', {'event': event})
+ else:
+ return redirect('/reg')
+
+def register_for_event(request, event_key):
+ """ check if the user is logged in.
+ simply add him to the attendees list.
+ """
+
+ user = request.user
+ if user.is_authenticated():
+ try:
+ event = Event.objects.get(key__iexact=event_key)
+ except Event.DoesNotExist:
+ return redirect("/reg")
+
+ event.attendees.add(user)
+ return render_to_response("event_register.html", {"user":user, 'event':event})
+ else:
+ return redirect("/reg")
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/reg_close.html Mon Apr 12 12:32:46 2010 +0530
@@ -0,0 +1,5 @@
+{% extends "base.html" %}
+{% block content %}
+ Registration for {{event.title}} has been successfully closed.<br />
+ <a href="/reg/event/view/{{event.key}}">Click here</a> to return to the event page.
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/reg_open.html Mon Apr 12 12:32:46 2010 +0530
@@ -0,0 +1,5 @@
+{% extends "base.html" %}
+{% block content %}
+ Registration for {{event.title}} has been successfully opened.<br />
+ <a href="/reg/event/view/{{event.key}}">Click here</a> to return to the event page.
+{% endblock %}
--- a/view_event.html Mon Apr 12 12:08:19 2010 +0530
+++ b/view_event.html Mon Apr 12 12:32:46 2010 +0530
@@ -13,7 +13,7 @@
{% endif %}
{% if can_submit_feedback %}
- <a href="/feedback/submit/{{event.key}}">Click here</a> to submit feedback for today's session.<br />
+ <a href="/feedback/submit/{{event.key}}">Click here</a> to submit feedback for day {{event.feedback_status}}.<br />
{% endif %}
{% if is_org %}