moved templates into templates directory and added user in context .
--- a/account_created.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
-The account has been created.<br />
-<a href="/reg/login">click here</a> to go to login page.
-{% endblock %}
--- a/base.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-<html>
-<head>
-<title>
-{% block title %}
-Workshop App
-{% endblock %}
-</title></head>
-<body>
-{% block content %}
-{% endblock %}
-</body>
-</html>
--- a/close_feedback.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
- Feedback for day {{day}} of {{event.title}} has been successfully closed.<br />
- <a href="/reg/event/view/{{event.key}}">Click here</a> to return to the event page.
-{% endblock %}
--- a/event_create.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
-<form action="" method="post">
-{{form.as_p}}
-<input type="submit" value="Create">
-</form>
-{% endblock %}
--- a/feedback.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
- {% if submitted %}
- Your feedback has been successfully submitted.
- {% else %}
- <form action="" method="post">
- {{ form.as_p }}
- <input type="submit" value="submit">
- </form>
- {% endif %}
-{% endblock %}
--- a/index.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
- {% for event in events %}
- <a href="/reg/event/view/{{event.key}}">{{event.title}}</a><br />
- {% endfor %}
-{% endblock %}
--- a/list_feedbacks.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
-{% for feed in feeds %}
- {{ feed }}<br />
-{% endfor %}
-{% endblock %}
--- a/login.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
-<form action="" method="post">
-{{ form.as_p }}
-<input type="submit" value="Login">
-</form>
-{% endblock %}
--- a/open_feedback.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
- {% if success %}
- The feedback for day {{day}} of {{event.title}} has been opened.<br />
- <a href="/reg/event/view/{{event.key}}">Click here</a> to return to the event page.
- {% else %}
- Select the day for workshop {{event.title}} to start accepting feedbacks.
- <form action="" method="post">
- Day:<br />
- <select name="day">
- {% for day in days %}
- <option value="{{day}}">Day {{day}}</option>
- {% endfor %}
- </select>
- <input value="Open" type="submit">
- </form>
- {% endif %}
-{% endblock %}
--- a/password_change.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
- {% if password_changed %}
- Your password has been successfully changed. <a href="/reg">Click here</a> to return to home page.
- {% else %}
- <form action="" method="post">
- {{form.as_p}}
- <input type="submit" value="Change">
- </form>
- {% endif %}
-{% endblock %}
--- a/password_reset.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
- {% if new_password %}
- Your password has been reset to {{ new_password }}. <a href="/reg">Click here</a> to return to home page.
- {% else %}
- <form action="" method="post">
- {{form.as_p}}
- <input type="submit" value="Change">
- </form>
- {% endif %}
-{% endblock %}
--- a/reg/site/urls.py Mon Apr 12 12:32:46 2010 +0530
+++ b/reg/site/urls.py Mon Apr 12 13:49:00 2010 +0530
@@ -11,6 +11,7 @@
(r'^password_change/$', reg_views.change_password),
(r'^event/create/$', reg_views.create_event),
(r'^event/view/(\w+)/$', reg_views.view_event),
+ (r'^event/register/(\w+)/$', reg_views),
(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),
--- a/reg/views.py Mon Apr 12 12:32:46 2010 +0530
+++ b/reg/views.py Mon Apr 12 13:49:00 2010 +0530
@@ -19,10 +19,9 @@
"""
user = request.user
-
events = Event.objects.all()[:10]
- return render_to_response('index.html', {'events':events})
+ return render_to_response('index.html', {'user':user, 'events':events})
def user_login(request):
""" get the user object from e-mail and then check for password.
@@ -43,10 +42,10 @@
login(request, user)
return redirect('/reg')
else:
- return render_to_response('login.html', {'form':form})
+ return render_to_response('login.html', {'user':user, 'form':form})
else:
form = reg_forms.LoginForm()
- return render_to_response('login.html', {'form':form})
+ return render_to_response('login.html', {'user':user, 'form':form})
def user_logout(request):
""" simply logout the user and redirect to homepage.
@@ -72,12 +71,12 @@
affiliated_to=data['affiliated_to'],
interests=data['interests']
)
- return render_to_response('account_created.html')
+ return render_to_response('account_created.html',{'user':user})
else:
- return render_to_response('register.html', {'form':form})
+ return render_to_response('register.html', {'user':user, 'form':form})
else:
form = reg_forms.RegisterForm()
- return render_to_response('register.html', {'form':form})
+ return render_to_response('register.html', {'user':user, 'form':form})
def create_event(request):
""" see if the user is a staff and only then let him do it.
@@ -98,10 +97,10 @@
event_url = "/reg/event/view/%s"%(new_event.key)
return redirect(event_url)
else:
- return render_to_response('event_create.html', {'form':form})
+ return render_to_response('event_create.html', {'user':user, 'form':form})
else:
form = reg_forms.EventCreateForm()
- return render_to_response('event_create.html', {'form':form})
+ return render_to_response('event_create.html', {'user':user, 'form':form})
else:
return redirect('/reg')
@@ -128,7 +127,8 @@
except Feedback.DoesNotExist:
can_submit_feedback = True
- context = {'is_guest': is_guest,
+ context = {'user': user,
+ 'is_guest': is_guest,
'event': event,
'is_attendee': is_attendee,
'is_org': is_org,
@@ -151,12 +151,12 @@
email = form.cleaned_data['email']
user = User.objects.get(email__iexact=email)
new_password = reg_events.reset_password(user)
- return render_to_response('password_reset.html', {'new_password':new_password})
+ return render_to_response('password_reset.html', {'user':user, 'new_password':new_password})
else:
- return render_to_response('password_reset.html', {'form':form})
+ return render_to_response('password_reset.html', {'user':user, 'form':form})
else:
form = reg_forms.PasswordResetForm()
- return render_to_response('password_reset.html', {'form':form})
+ return render_to_response('password_reset.html', {'user':user, 'form':form})
def change_password(request):
""" check for the password and then set the new password.
@@ -173,12 +173,12 @@
if form.is_valid():
new_password = form.cleaned_data['new_password']
reg_events.change_password(user, new_password)
- return render_to_response('password_change.html', {'password_changed': True})
+ return render_to_response('password_change.html', {'user':user, 'password_changed': True})
else:
- return render_to_response('password_change.html', {'form':form})
+ return render_to_response('password_change.html', {'user':user, 'form':form})
else:
form = reg_forms.PasswordChangeForm()
- return render_to_response('password_change.html', {'form':form})
+ return render_to_response('password_change.html', {'user':user, 'form':form})
def open_feedback(request, event_key):
""" see if the event exists.
@@ -202,9 +202,9 @@
day = request.POST['day']
event.feedback_status = day
event.save()
- return render_to_response('open_feedback.html', {'success': True, 'day':day, 'event':event})
+ return render_to_response('open_feedback.html', {'user':user, 'success': True, 'day':day, 'event':event})
else:
- return render_to_response('open_feedback.html', {'event': event, 'days': range(1,days+1)})
+ return render_to_response('open_feedback.html', {'user':user, 'event': event, 'days': range(1,days+1)})
else:
return redirect('/reg')
@@ -225,7 +225,7 @@
day = event.feedback_status
event.feedback_status = '0'
event.save()
- return render_to_response('close_feedback.html', {'event': event, 'day':day})
+ return render_to_response('close_feedback.html', {'user':user, 'event': event, 'day':day})
else:
return redirect('/reg')
@@ -244,7 +244,7 @@
if is_org:
event.registration_is_open = True
event.save()
- return render_to_response('reg_open.html', {'event': event})
+ return render_to_response('reg_open.html', {'user':user, 'event': event})
else:
return redirect('/reg')
@@ -263,7 +263,7 @@
if is_org:
event.registration_is_open = False
event.save()
- return render_to_response('reg_close.html', {'event': event})
+ return render_to_response('reg_close.html', {'user':user, 'event': event})
else:
return redirect('/reg')
--- a/reg_close.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-{% 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 %}
--- a/reg_open.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-{% 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/register.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
-<form action="" method="post">
-{{ form.as_p }}
-<input type="submit" value="submit">
-</form>
-{% endblock %}
--- a/settings.py Mon Apr 12 12:32:46 2010 +0530
+++ b/settings.py Mon Apr 12 13:49:00 2010 +0530
@@ -69,7 +69,7 @@
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
- '.',
+ './templates',
)
INSTALLED_APPS = (
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/account_created.html Mon Apr 12 13:49:00 2010 +0530
@@ -0,0 +1,5 @@
+{% extends "base.html" %}
+{% block content %}
+The account has been created.<br />
+<a href="/reg/login">click here</a> to go to login page.
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/base.html Mon Apr 12 13:49:00 2010 +0530
@@ -0,0 +1,21 @@
+<html>
+<head>
+<title>
+{% block title %}
+Workshop App
+{% endblock %}
+</title></head>
+<body>
+{% if user.is_authenticated %}
+ Welcome {{user.get_full_name}} |
+ <a href="/reg/profile/edit">My Profile</a> |
+ <a href="/reg/logout">Logout</a>
+{% else %}
+ <a href="/reg/login/">Login</a> |
+ <a href="/reg/register/">Register</a>
+{% endif %}
+<br />
+{% block content %}
+{% endblock %}
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/close_feedback.html Mon Apr 12 13:49:00 2010 +0530
@@ -0,0 +1,5 @@
+{% extends "base.html" %}
+{% block content %}
+ Feedback for day {{day}} of {{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/templates/event_create.html Mon Apr 12 13:49:00 2010 +0530
@@ -0,0 +1,7 @@
+{% extends "base.html" %}
+{% block content %}
+<form action="" method="post">
+{{form.as_p}}
+<input type="submit" value="Create">
+</form>
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/feedback.html Mon Apr 12 13:49:00 2010 +0530
@@ -0,0 +1,11 @@
+{% extends "base.html" %}
+{% block content %}
+ {% if submitted %}
+ Your feedback has been successfully submitted.
+ {% else %}
+ <form action="" method="post">
+ {{ form.as_p }}
+ <input type="submit" value="submit">
+ </form>
+ {% endif %}
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/index.html Mon Apr 12 13:49:00 2010 +0530
@@ -0,0 +1,6 @@
+{% extends "base.html" %}
+{% block content %}
+ {% for event in events %}
+ <a href="/reg/event/view/{{event.key}}">{{event.title}}</a><br />
+ {% endfor %}
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/list_feedbacks.html Mon Apr 12 13:49:00 2010 +0530
@@ -0,0 +1,6 @@
+{% extends "base.html" %}
+{% block content %}
+{% for feed in feeds %}
+ {{ feed }}<br />
+{% endfor %}
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/login.html Mon Apr 12 13:49:00 2010 +0530
@@ -0,0 +1,7 @@
+{% extends "base.html" %}
+{% block content %}
+<form action="" method="post">
+{{ form.as_p }}
+<input type="submit" value="Login">
+</form>
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/open_feedback.html Mon Apr 12 13:49:00 2010 +0530
@@ -0,0 +1,18 @@
+{% extends "base.html" %}
+{% block content %}
+ {% if success %}
+ The feedback for day {{day}} of {{event.title}} has been opened.<br />
+ <a href="/reg/event/view/{{event.key}}">Click here</a> to return to the event page.
+ {% else %}
+ Select the day for workshop {{event.title}} to start accepting feedbacks.
+ <form action="" method="post">
+ Day:<br />
+ <select name="day">
+ {% for day in days %}
+ <option value="{{day}}">Day {{day}}</option>
+ {% endfor %}
+ </select>
+ <input value="Open" type="submit">
+ </form>
+ {% endif %}
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/password_change.html Mon Apr 12 13:49:00 2010 +0530
@@ -0,0 +1,11 @@
+{% extends "base.html" %}
+{% block content %}
+ {% if password_changed %}
+ Your password has been successfully changed. <a href="/reg">Click here</a> to return to home page.
+ {% else %}
+ <form action="" method="post">
+ {{form.as_p}}
+ <input type="submit" value="Change">
+ </form>
+ {% endif %}
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/password_reset.html Mon Apr 12 13:49:00 2010 +0530
@@ -0,0 +1,11 @@
+{% extends "base.html" %}
+{% block content %}
+ {% if new_password %}
+ Your password has been reset to {{ new_password }}. <a href="/reg">Click here</a> to return to home page.
+ {% else %}
+ <form action="" method="post">
+ {{form.as_p}}
+ <input type="submit" value="Change">
+ </form>
+ {% endif %}
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/reg_close.html Mon Apr 12 13:49:00 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/templates/reg_open.html Mon Apr 12 13:49:00 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 %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/register.html Mon Apr 12 13:49:00 2010 +0530
@@ -0,0 +1,7 @@
+{% extends "base.html" %}
+{% block content %}
+<form action="" method="post">
+{{ form.as_p }}
+<input type="submit" value="submit">
+</form>
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/view_event.html Mon Apr 12 13:49:00 2010 +0530
@@ -0,0 +1,40 @@
+{% extends "base.html" %}
+{% block content %}
+ <h3>{{ event.title }}</h3><br />
+ Description:<br />
+ {{event.description}}<br />
+ duration of the workshop: {{event.start_date}} to {{event.stop_date}}<br />
+ {% if not is_guest %}
+ {% if is_attendee %}
+ You have registered for this workshop.
+ {% else %}
+ <a href="/reg/event/register/{{event.key}}">Click here</a> to register for the workshop.<br />
+ {% endif %}
+ {% endif %}
+
+ {% if can_submit_feedback %}
+ <a href="/feedback/submit/{{event.key}}">Click here</a> to submit feedback for day {{event.feedback_status}}.<br />
+ {% endif %}
+
+ {% if is_org %}
+ {% if event.registration_is_open %}
+ <a href="/reg/event/registration/close/{{event.key}}">Click here</a> to close the registration.<br />
+ {% else %}
+ <a href="/reg/event/registration/open/{{event.key}}">Click here</a> to open the registration.<br />
+ {% endif %}
+
+ {% ifequal event.quiz_status "00" %}
+ <a href="/reg/event/quiz/open/{{event.key}}">Click here</a> to open quiz.<br />
+ {% else %}
+ <a href="/reg/event/registration/close/{{event.key}}">Click here</a> to close the registration.<br />
+ {% endifequal %}
+
+ {% ifequal event.feedback_status "0" %}
+ <a href="/reg/event/feedback/open/{{event.key}}">Click here</a> to open the feedback.<br />
+ {% else %}
+ <a href="/feedback/list/{{event.key}}">Click here</a> to see the feedbacks that we submitted.<br />
+ <a href="/reg/event/feedback/close/{{event.key}}">Click here</a> to close the feedback for day {{event.feedback_status}}.<br />
+ {% endifequal %}
+ {% endif %}
+
+{% endblock %}
--- a/view_event.html Mon Apr 12 12:32:46 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
- <h3>{{ event.title }}</h3><br />
- Description:<br />
- {{event.description}}<br />
- duration of the workshop: {{event.start_date}} to {{event.stop_date}}<br />
- {% if not is_guest %}
- {% if is_attendee %}
- You have registered for this workshop.
- {% else %}
- <a href="/reg/event/register/{{event.key}}">Click here</a> to register for the workshop.<br />
- {% endif %}
- {% endif %}
-
- {% if can_submit_feedback %}
- <a href="/feedback/submit/{{event.key}}">Click here</a> to submit feedback for day {{event.feedback_status}}.<br />
- {% endif %}
-
- {% if is_org %}
- {% if event.registration_is_open %}
- <a href="/reg/event/registration/close/{{event.key}}">Click here</a> to close the registration.<br />
- {% else %}
- <a href="/reg/event/registration/open/{{event.key}}">Click here</a> to open the registration.<br />
- {% endif %}
-
- {% ifequal event.quiz_status "00" %}
- <a href="/reg/event/quiz/open/{{event.key}}">Click here</a> to open quiz.<br />
- {% else %}
- <a href="/reg/event/registration/close/{{event.key}}">Click here</a> to close the registration.<br />
- {% endifequal %}
-
- {% ifequal event.feedback_status "0" %}
- <a href="/reg/event/feedback/open/{{event.key}}">Click here</a> to open the feedback.<br />
- {% else %}
- <a href="/feedback/list/{{event.key}}">Click here</a> to see the feedbacks that we submitted.<br />
- <a href="/reg/event/feedback/close/{{event.key}}">Click here</a> to close the feedback for day {{event.feedback_status}}.<br />
- {% endifequal %}
- {% endif %}
-
-{% endblock %}