author | nishanth |
Tue, 20 Apr 2010 01:31:45 +0530 | |
changeset 7 | dfedb369f32e |
parent 6 | 8929b82c1dbb |
child 9 | 601057af86c2 |
permissions | -rw-r--r-- |
6 | 1 |
from django.http import Http404 |
2 |
from django.shortcuts import render_to_response |
|
3 |
||
4 |
from offline.event.models import Event |
|
5 |
||
7
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
6 |
from offline.settings import ADMIN_KEY |
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
7 |
|
6 | 8 |
def event_home(request): |
9 |
""" The page for people to view. |
|
10 |
""" |
|
11 |
||
12 |
try: |
|
13 |
event = Event.objects.all()[0] |
|
14 |
except IndexError: |
|
15 |
raise Http404 |
|
16 |
||
17 |
ip = request.META['REMOTE_ADDR'] |
|
18 |
||
19 |
can_submit_feedback = True if event.feedback_status != '0' and \ |
|
20 |
not event.feedback.filter(day=event.feedback_status,user_ip=ip) else False |
|
21 |
can_take_quiz = False |
|
22 |
||
23 |
return render_to_response('home.html', {'event':event, 'can_submit_feedback':can_submit_feedback, 'can_take_quiz':can_take_quiz}) |
|
24 |
||
7
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
25 |
def event_admin(request, key_word): |
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
26 |
""" see if the key is correct and then display options. |
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
27 |
""" |
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
28 |
|
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
29 |
if not key_word == ADMIN_KEY: |
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
30 |
raise Http404 |
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
31 |
|
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
32 |
try: |
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
33 |
event = Event.objects.all()[0] |
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
34 |
except IndexError: |
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
35 |
return redirect('/event/create/%s'%ADMIN_KEY) |
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
36 |
|
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
37 |
return render_to_response('admin.html', {'event':event, 'admin_key':ADMIN_KEY}) |
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
38 |
|
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
39 |
def event_create(): |
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
40 |
pass |
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
41 |
|
dfedb369f32e
first fixed on the urls and then gave the admin_key in settings and then created main admin page.
nishanth
parents:
6
diff
changeset
|
42 |