summaryrefslogtreecommitdiff
path: root/certificate
diff options
context:
space:
mode:
Diffstat (limited to 'certificate')
-rwxr-xr-xcertificate/templates/osdag_workshop_feedback.html36
-rwxr-xr-xcertificate/views.py36
2 files changed, 56 insertions, 16 deletions
diff --git a/certificate/templates/osdag_workshop_feedback.html b/certificate/templates/osdag_workshop_feedback.html
index 6696ad1..14e5c74 100755
--- a/certificate/templates/osdag_workshop_feedback.html
+++ b/certificate/templates/osdag_workshop_feedback.html
@@ -1,20 +1,26 @@
- {% extends 'base.html' %}
+{% extends 'base.html' %}
-{% block header %}
- <h1> Osdag Workshop </h1>
+{% block header%}
+ <h1> OSDAG Workshop 2015 </h1>
{% endblock %}
-
{% block content %}
-<p> Your feedback will help us improve our services. Thank you for your time. </p>
- <div style = "width:50%; margin:auto">
- <ul class = "nav nav-list">
- <li><a href = "https://docs.google.com/forms/d/1X7TXaEhwUCpkZWXZMxoF4aywv1XUXNaKhfLpd1BC3w8/viewform?c=0&w=1&usp=mail_form_link" target = "popup" >Feedback on Osdag Workshop 2016</a></li>
- </ul>
- <br>
- <a class="btn btn-primary" style="float:right" href = "{% url 'certificate:osdag_workshop_download' %}">Skip feedback and download</a>
- </div>
-{% endblock %}
-
-
+ <div style="width:50%; margin: 0 auto" >
+<form action="{% url 'certificate:osdag_workshop_feedback' %}" method="post">
+ <h1> Feedback </h1>
+ <p>Your feedback will help us improve our services. Thank you for your time.</p>
+ {{ detail }}
+ {% csrf_token %}
+ <table class="table">
+ {{ form }}
+ </table>
+ {% for question in questions %}
+ <label style="float:left">{{ forloop.counter }}. {{ question.question }} </label><br>
+ <textarea cols="80" class="form-control" id="{{ question.id }}" name="{{ question.id }}"></textarea><br>
+ {% endfor %}
+ <button style="float:left" class="btn btn-primary" type="submit">Submit</button>
+ <a style="float:right" href="{% url 'certificate:osdag_workshop_download' %}" >Skip feedback and download</a>
+ </form>
+ </div>
+{% endblock %}
diff --git a/certificate/views.py b/certificate/views.py
index 4e5819f..638fde0 100755
--- a/certificate/views.py
+++ b/certificate/views.py
@@ -1110,7 +1110,41 @@ def osdag_workshop_download(request):
return render_to_response('osdag_workshop_download.html', context, ci)
def osdag_workshop_feedback(request):
- return render_to_response('osdag_workshop_feedback.html')
+ context = {}
+ ci = RequestContext(request)
+ form = FeedBackForm()
+ questions = Question.objects.filter(purpose='OWS')
+ if request.method == 'POST':
+ form = FeedBackForm(request.POST)
+ if form.is_valid():
+ data = form.cleaned_data
+ try:
+ FeedBack.objects.get(email=data['email'].strip(), purpose='DWS')
+ context['message'] = 'You have already submitted the feedback. You can download your certificate.'
+ return render_to_response('osdag_workshop_download.html', context, ci)
+ except FeedBack.DoesNotExist:
+ feedback = FeedBack()
+ feedback.name = data['name'].strip()
+ feedback.email = data['email'].strip()
+ feedback.purpose = 'DWS'
+ feedback.submitted = True
+ feedback.save()
+ for question in questions:
+ answered = request.POST.get('{0}'.format(question.id), None)
+ answer = Answer()
+ answer.question = question
+ answer.answer = answered.strip()
+ answer.save()
+ feedback.answer.add(answer)
+ feedback.save()
+ context['message'] = ''
+ return render_to_response('osdag_workshop_download.html', context, ci)
+
+ context['form'] = form
+ context['questions'] = questions
+
+ return render_to_response('osdag_workshop_feedback.html', context, ci)
+
def create_osdag_workshop_certificate(certificate_path, name, qrcode, type, paper, workshop, file_name):
error = False