author | nishanth |
Mon, 12 Apr 2010 04:23:13 +0530 | |
changeset 10 | c52d170969f0 |
parent 5 | 37e4027fba48 |
child 11 | 334550460bd7 |
permissions | -rw-r--r-- |
5 | 1 |
from django.shortcuts import render_to_response, redirect |
2 |
||
3 |
from workshop.feedback.models import Feedback |
|
4 |
from workshop.feedback.forms import FeedbackForm |
|
5 |
||
6 |
from django.http import HttpResponse |
|
7 |
||
10
c52d170969f0
quite a few changes. modified models and feedback views .
nishanth
parents:
5
diff
changeset
|
8 |
def submit_feedback(request, event_key): |
5 | 9 |
""" see if the ip address has already submitted a feedback. |
10 |
if not, collect the feedback. |
|
11 |
""" |
|
12 |
||
13 |
ip = request.META["REMOTE_ADDR"] |
|
14 |
print 'ip', ip |
|
15 |
||
16 |
if request.method == "POST": |
|
17 |
form = FeedbackForm(request.POST) |
|
18 |
if form.is_valid(): |
|
19 |
form.save() |
|
20 |
return HttpResponse('Good. now click <a href="/feedback/list">here</a>') |
|
21 |
else: |
|
22 |
return render_to_response('feedback.html',{'form':form}) |
|
23 |
else: |
|
24 |
form = FeedbackForm() |
|
25 |
return render_to_response('feedback.html',{'form':form}) |
|
26 |
||
10
c52d170969f0
quite a few changes. modified models and feedback views .
nishanth
parents:
5
diff
changeset
|
27 |
def list_feedbacks(request, event_key): |
5 | 28 |
""" print a list of all the feedbacks collected. |
29 |
""" |
|
30 |
||
31 |
feeds = Feedback.objects.all() |
|
32 |
return render_to_response('list_feedbacks.html',{'feeds':feeds}) |