From dc0c3cef4b19067ee34234f295d8e96649add6f5 Mon Sep 17 00:00:00 2001
From: Yasin <mohammed-yasin.rahman@lip6.fr>
Date: Fri, 17 Jan 2014 14:37:35 +0100
Subject: [PATCH] Fix: ContactForm

---
 portal/contactview.py                      |  4 ++--
 portal/forms.py                            |  2 +-
 portal/templates/contact-support-email.txt | 12 ++++++++++++
 3 files changed, 15 insertions(+), 3 deletions(-)
 create mode 100644 portal/templates/contact-support-email.txt

diff --git a/portal/contactview.py b/portal/contactview.py
index 796c8b04..918385f5 100644
--- a/portal/contactview.py
+++ b/portal/contactview.py
@@ -18,7 +18,7 @@ class ContactView (FreeAccessView):
             # Process the data in form.cleaned_data
             first_name = form.cleaned_data['first_name']
             last_name = form.cleaned_data['last_name']
-            affiliation = form.cleaned_data['affiliation']
+            authority = form.cleaned_data['authority']
             subject = form.cleaned_data['subject']
             message = form.cleaned_data['message']
             email = form.cleaned_data['email'] # email of the sender
@@ -29,7 +29,7 @@ class ContactView (FreeAccessView):
             if cc_myself:
                 recipients.append(email)
 
-            msg = render_to_string('slice-request-email.txt', form.cleaned_data)
+            msg = render_to_string('contact-support-email.txt', form.cleaned_data)
             send_mail("Onelab user %s submitted a query "%email, msg, email, recipients)
             return render(request,'contact_sent.html') # Redirect after POST
         else:
diff --git a/portal/forms.py b/portal/forms.py
index df5c1a67..c7cb7f06 100644
--- a/portal/forms.py
+++ b/portal/forms.py
@@ -56,7 +56,7 @@ from django.template import loader
 class ContactForm(forms.Form):
     first_name = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control'}))
     last_name = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control'}))
-    affiliation = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control'}))
+    authority = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control'}))
     email = forms.EmailField(widget=forms.TextInput(attrs={'class':'form-control'}))
     subject = forms.CharField(max_length=100,widget=forms.TextInput(attrs={'class':'form-control'}))
     message = forms.CharField(widget=forms.Textarea(attrs={'class':'form-control'}))
diff --git a/portal/templates/contact-support-email.txt b/portal/templates/contact-support-email.txt
new file mode 100644
index 00000000..b7733a07
--- /dev/null
+++ b/portal/templates/contact-support-email.txt
@@ -0,0 +1,12 @@
+User details: 
+
+First name      : {{first_name}}
+Last name 		: {{last_name}}
+email           : {{email}}
+Authority	    : {{authority}}
+
+Query Details:
+
+Subject         : {{subject}}
+message         : {{message}}
+
-- 
2.47.0