From c6f93b963d9ac30a0b7754b45aeba216ccea1ef9 Mon Sep 17 00:00:00 2001
From: Yasin <mohammed-yasin.rahman@lip6.fr>
Date: Mon, 14 Apr 2014 12:07:26 +0200
Subject: [PATCH] Slice Req Email: Dynamically add portal domain name

---
 portal/slicerequestview.py                | 8 ++++++++
 portal/templates/slice_request_email.html | 1 +
 portal/templates/slice_request_email.txt  | 1 +
 3 files changed, 10 insertions(+)

diff --git a/portal/slicerequestview.py b/portal/slicerequestview.py
index 1f377d84..213fd318 100644
--- a/portal/slicerequestview.py
+++ b/portal/slicerequestview.py
@@ -1,4 +1,6 @@
 from django.shortcuts           import render
+from django.contrib.sites.models import Site
+
 
 from unfold.page                import Page
 
@@ -63,6 +65,11 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
 
         if method == 'POST':
             # The form has been submitted
+
+            # get the domain url
+            current_site = Site.objects.get_current()
+            current_site = current_site.domain
+
             slice_request = {
                 'type'              : 'slice',
                 'id'                : None,
@@ -73,6 +80,7 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
                 'number_of_nodes'   : wsgi_request.POST.get('number_of_nodes', ''),
                 'type_of_nodes'     : wsgi_request.POST.get('type_of_nodes', ''),
                 'purpose'           : wsgi_request.POST.get('purpose', ''),
+                'current_site'      : current_site
             }
             
             authority_hrn = slice_request['authority_hrn']
diff --git a/portal/templates/slice_request_email.html b/portal/templates/slice_request_email.html
index 5e90741a..6db35a73 100644
--- a/portal/templates/slice_request_email.html
+++ b/portal/templates/slice_request_email.html
@@ -5,5 +5,6 @@
 <b>type of nodes   :</b> {{type_of_nodes}}</br>
 <b>purpose         :</b> {{purpose}}</br>
 <b>email           :</b> {{email}}</br>
+<b>Portal url	   :</b> {{current_site}}</br> 
 <b>cc myself       :</b> {{cc_myself}}</br>
 
diff --git a/portal/templates/slice_request_email.txt b/portal/templates/slice_request_email.txt
index ef46a04c..a0d94cdb 100644
--- a/portal/templates/slice_request_email.txt
+++ b/portal/templates/slice_request_email.txt
@@ -5,5 +5,6 @@ number of nodes : {{number_of_nodes}}
 type of nodes   : {{type_of_nodes}}
 purpose         : {{purpose}}
 email           : {{email}}
+Portal url		: {{current_site}}
 cc myself       : {{cc_myself}}
 
-- 
2.47.0