--- a/event/views.py Mon Apr 19 22:36:23 2010 +0530
+++ b/event/views.py Mon Apr 19 23:01:24 2010 +0530
@@ -1,1 +1,22 @@
-# Create your views here.
+from django.http import Http404
+from django.shortcuts import render_to_response
+
+from offline.event.models import Event
+
+def event_home(request):
+ """ The page for people to view.
+ """
+
+ try:
+ event = Event.objects.all()[0]
+ except IndexError:
+ raise Http404
+
+ ip = request.META['REMOTE_ADDR']
+
+ can_submit_feedback = True if event.feedback_status != '0' and \
+ not event.feedback.filter(day=event.feedback_status,user_ip=ip) else False
+ can_take_quiz = False
+
+ return render_to_response('home.html', {'event':event, 'can_submit_feedback':can_submit_feedback, 'can_take_quiz':can_take_quiz})
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/home.html Mon Apr 19 23:01:24 2010 +0530
@@ -0,0 +1,10 @@
+{% extends 'base.html' %}
+{% block content %}
+<h3>{{event.title}}</h3>
+{% if can_submit_feedback %}
+ <a href="/feedback/submit">Submit Feedback</a><br />
+{% endif %}
+{% if can_take_quiz %}
+<a href="/quiz">Attempt {{quiz_name}} </a><br />
+{% endif %}
+{% endblock %}
--- a/urls.py Mon Apr 19 22:36:23 2010 +0530
+++ b/urls.py Mon Apr 19 23:01:24 2010 +0530
@@ -1,6 +1,7 @@
from django.conf.urls.defaults import *
-from offline.feedback.views import submit_feedback
+from offline.feedback import views as feed_views
+from offline.event import views as event_views
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
@@ -16,5 +17,6 @@
# Uncomment the next line to enable the admin:
# (r'^admin/', include(admin.site.urls)),
- (r'^feedback/submit', submit_feedback)
+ (r'^$', event_views.event_home),
+ (r'^feedback/submit', feed_views.submit_feedback)
)