Add "done" step on the form wizard
authorGu1 <gu1@cafai.fr>
Fri, 12 Apr 2013 16:47:25 +0000 (18:47 +0200)
committerGu1 <gu1@cafai.fr>
Fri, 12 Apr 2013 16:47:25 +0000 (18:47 +0200)
fdneligibility/templates/fdneligibility/done.html [new file with mode: 0644]
fdneligibility/utils.py
fdneligibility/views.py

diff --git a/fdneligibility/templates/fdneligibility/done.html b/fdneligibility/templates/fdneligibility/done.html
new file mode 100644 (file)
index 0000000..4611866
--- /dev/null
@@ -0,0 +1,4 @@
+{% extends "fdneligibility/form.html" %}
+{% block formeligibility %}
+text goes here
+{% endblock %}
index 749fd6a..c6994f5 100644 (file)
@@ -8,18 +8,18 @@ import os.path
 APP_ROOT = os.path.dirname(os.path.realpath(__file__))
 
 class VerifiedHTTPSConnection(httplib.HTTPSConnection):
-        def __init__(self, *args, **kwargs):
-            self.__ca_certs=kwargs.pop('ca_certs')
-            httplib.HTTPSConnection.__init__(self, *args, **kwargs)
+    def __init__(self, *args, **kwargs):
+        self.__ca_certs=kwargs.pop('ca_certs')
+        httplib.HTTPSConnection.__init__(self, *args, **kwargs)
 
-        def connect(self):
-            "Connect to a host on a given (SSL) port."
+    def connect(self):
+        "Connect to a host on a given (SSL) port."
 
-            sock = socket.create_connection((self.host, self.port),
-                                            self.timeout, self.source_address)
-            if self._tunnel_host:
-                self.sock = sock
-                self._tunnel()
-            self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file,
-                                        cert_reqs=ssl.CERT_REQUIRED,
-                                        ca_certs=self.__ca_certs)
+        sock = socket.create_connection((self.host, self.port),
+                                        self.timeout, self.source_address)
+        if self._tunnel_host:
+            self.sock = sock
+            self._tunnel()
+        self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file,
+                                    cert_reqs=ssl.CERT_REQUIRED,
+                                    ca_certs=self.__ca_certs)
index 88f94ab..a380376 100644 (file)
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 from django.contrib.formtools.wizard.views import SessionWizardView
 from django.utils.translation import ugettext_lazy as _
+from django.shortcuts import render
 from forms import EligibilityForm1, EligibilityForm2
 from utils import VerifiedHTTPSConnection, APP_ROOT
 from httplib import HTTPException
@@ -117,5 +118,9 @@ class EligibilityWizard(SessionWizardView):
                 form._errors[NON_FIELD_ERRORS] = form.error_class([_(u"Could not test your eligibility")])
                 return self.render(form)
 
-
         return super(EligibilityWizard, self).render_next_step(form, **kwargs)
+
+    def done(self, form_list, **kwargs):
+        return render(self.request, 'fdneligibility/done.html', {
+            'form_data': [form.cleaned_data for form in form_list]
+        })