# HG changeset patch # User nishanth # Date 1271060340 -19800 # Node ID cd6911eaac2c0f3186c5a3f4ef1c4d064a4c3acd # Parent 05248e27104a2767fb049f239930cfe2ae432c71 moved templates into templates directory and added user in context . diff -r 05248e27104a -r cd6911eaac2c account_created.html --- 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.
-click here to go to login page. -{% endblock %} diff -r 05248e27104a -r cd6911eaac2c base.html --- 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 @@ - - - -{% block title %} -Workshop App -{% endblock %} - - -{% block content %} -{% endblock %} - - diff -r 05248e27104a -r cd6911eaac2c close_feedback.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.
- Click here to return to the event page. -{% endblock %} diff -r 05248e27104a -r cd6911eaac2c event_create.html --- 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.as_p}} - -
-{% endblock %} diff -r 05248e27104a -r cd6911eaac2c feedback.html --- 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.as_p }} - -
- {% endif %} -{% endblock %} diff -r 05248e27104a -r cd6911eaac2c index.html --- 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 %} - {{event.title}}
- {% endfor %} -{% endblock %} diff -r 05248e27104a -r cd6911eaac2c list_feedbacks.html --- 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 }}
-{% endfor %} -{% endblock %} diff -r 05248e27104a -r cd6911eaac2c login.html --- 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.as_p }} - -
-{% endblock %} diff -r 05248e27104a -r cd6911eaac2c open_feedback.html --- 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.
- Click here to return to the event page. - {% else %} - Select the day for workshop {{event.title}} to start accepting feedbacks. -
- Day:
- - -
- {% endif %} -{% endblock %} diff -r 05248e27104a -r cd6911eaac2c password_change.html --- 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. Click here to return to home page. - {% else %} -
- {{form.as_p}} - -
- {% endif %} -{% endblock %} diff -r 05248e27104a -r cd6911eaac2c password_reset.html --- 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 }}. Click here to return to home page. - {% else %} -
- {{form.as_p}} - -
- {% endif %} -{% endblock %} diff -r 05248e27104a -r cd6911eaac2c reg/site/urls.py --- 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), diff -r 05248e27104a -r cd6911eaac2c reg/views.py --- 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') diff -r 05248e27104a -r cd6911eaac2c reg_close.html --- 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.
- Click here to return to the event page. -{% endblock %} diff -r 05248e27104a -r cd6911eaac2c reg_open.html --- 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.
- Click here to return to the event page. -{% endblock %} diff -r 05248e27104a -r cd6911eaac2c register.html --- 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.as_p }} - -
-{% endblock %} diff -r 05248e27104a -r cd6911eaac2c settings.py --- 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 = ( diff -r 05248e27104a -r cd6911eaac2c templates/account_created.html --- /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.
+click here to go to login page. +{% endblock %} diff -r 05248e27104a -r cd6911eaac2c templates/base.html --- /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 @@ + + + +{% block title %} +Workshop App +{% endblock %} + + +{% if user.is_authenticated %} + Welcome {{user.get_full_name}} | + My Profile | + Logout +{% else %} + Login | + Register +{% endif %} +
+{% block content %} +{% endblock %} + + diff -r 05248e27104a -r cd6911eaac2c templates/close_feedback.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.
+ Click here to return to the event page. +{% endblock %} diff -r 05248e27104a -r cd6911eaac2c templates/event_create.html --- /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.as_p}} + +
+{% endblock %} diff -r 05248e27104a -r cd6911eaac2c templates/feedback.html --- /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.as_p }} + +
+ {% endif %} +{% endblock %} diff -r 05248e27104a -r cd6911eaac2c templates/index.html --- /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 %} + {{event.title}}
+ {% endfor %} +{% endblock %} diff -r 05248e27104a -r cd6911eaac2c templates/list_feedbacks.html --- /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 }}
+{% endfor %} +{% endblock %} diff -r 05248e27104a -r cd6911eaac2c templates/login.html --- /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.as_p }} + +
+{% endblock %} diff -r 05248e27104a -r cd6911eaac2c templates/open_feedback.html --- /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.
+ Click here to return to the event page. + {% else %} + Select the day for workshop {{event.title}} to start accepting feedbacks. +
+ Day:
+ + +
+ {% endif %} +{% endblock %} diff -r 05248e27104a -r cd6911eaac2c templates/password_change.html --- /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. Click here to return to home page. + {% else %} +
+ {{form.as_p}} + +
+ {% endif %} +{% endblock %} diff -r 05248e27104a -r cd6911eaac2c templates/password_reset.html --- /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 }}. Click here to return to home page. + {% else %} +
+ {{form.as_p}} + +
+ {% endif %} +{% endblock %} diff -r 05248e27104a -r cd6911eaac2c templates/reg_close.html --- /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.
+ Click here to return to the event page. +{% endblock %} diff -r 05248e27104a -r cd6911eaac2c templates/reg_open.html --- /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.
+ Click here to return to the event page. +{% endblock %} diff -r 05248e27104a -r cd6911eaac2c templates/register.html --- /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.as_p }} + +
+{% endblock %} diff -r 05248e27104a -r cd6911eaac2c templates/view_event.html --- /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 %} +

{{ event.title }}


+ Description:
+ {{event.description}}
+ duration of the workshop: {{event.start_date}} to {{event.stop_date}}
+ {% if not is_guest %} + {% if is_attendee %} + You have registered for this workshop. + {% else %} + Click here to register for the workshop.
+ {% endif %} + {% endif %} + + {% if can_submit_feedback %} + Click here to submit feedback for day {{event.feedback_status}}.
+ {% endif %} + + {% if is_org %} + {% if event.registration_is_open %} + Click here to close the registration.
+ {% else %} + Click here to open the registration.
+ {% endif %} + + {% ifequal event.quiz_status "00" %} + Click here to open quiz.
+ {% else %} + Click here to close the registration.
+ {% endifequal %} + + {% ifequal event.feedback_status "0" %} + Click here to open the feedback.
+ {% else %} + Click here to see the feedbacks that we submitted.
+ Click here to close the feedback for day {{event.feedback_status}}.
+ {% endifequal %} + {% endif %} + +{% endblock %} diff -r 05248e27104a -r cd6911eaac2c view_event.html --- 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 %} -

{{ event.title }}


- Description:
- {{event.description}}
- duration of the workshop: {{event.start_date}} to {{event.stop_date}}
- {% if not is_guest %} - {% if is_attendee %} - You have registered for this workshop. - {% else %} - Click here to register for the workshop.
- {% endif %} - {% endif %} - - {% if can_submit_feedback %} - Click here to submit feedback for day {{event.feedback_status}}.
- {% endif %} - - {% if is_org %} - {% if event.registration_is_open %} - Click here to close the registration.
- {% else %} - Click here to open the registration.
- {% endif %} - - {% ifequal event.quiz_status "00" %} - Click here to open quiz.
- {% else %} - Click here to close the registration.
- {% endifequal %} - - {% ifequal event.feedback_status "0" %} - Click here to open the feedback.
- {% else %} - Click here to see the feedbacks that we submitted.
- Click here to close the feedback for day {{event.feedback_status}}.
- {% endifequal %} - {% endif %} - -{% endblock %}