6
|
1 |
from django.http import Http404
|
|
2 |
from django.shortcuts import render_to_response
|
|
3 |
|
|
4 |
from offline.event.models import Event
|
|
5 |
|
|
6 |
def event_home(request):
|
|
7 |
""" The page for people to view.
|
|
8 |
"""
|
|
9 |
|
|
10 |
try:
|
|
11 |
event = Event.objects.all()[0]
|
|
12 |
except IndexError:
|
|
13 |
raise Http404
|
|
14 |
|
|
15 |
ip = request.META['REMOTE_ADDR']
|
|
16 |
|
|
17 |
can_submit_feedback = True if event.feedback_status != '0' and \
|
|
18 |
not event.feedback.filter(day=event.feedback_status,user_ip=ip) else False
|
|
19 |
can_take_quiz = False
|
|
20 |
|
|
21 |
return render_to_response('home.html', {'event':event, 'can_submit_feedback':can_submit_feedback, 'can_take_quiz':can_take_quiz})
|
|
22 |
|