From b502cb5da842803782d1d6be5dc93d4c6da912f8 Mon Sep 17 00:00:00 2001
From: PCoder <purple.coder@yahoo.co.uk>
Date: Sat, 1 Jul 2017 04:29:11 +0530
Subject: [PATCH] Fixed logo in payment/order confirmation page not redirecting
 to index issue

---
 datacenterlight/views.py                  | 6 ++++--
 hosting/templates/hosting/base_short.html | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/datacenterlight/views.py b/datacenterlight/views.py
index c0fbdb6f..07709981 100644
--- a/datacenterlight/views.py
+++ b/datacenterlight/views.py
@@ -204,7 +204,7 @@ class IndexView(CreateView):
             manager = OpenNebulaManager()
             templates = manager.get_templates()
             context = {
-                'templates': VirtualMachineTemplateSerializer(templates, many=True).data,
+                'templates': VirtualMachineTemplateSerializer(templates, many=True).data
             }
         except:
             messages.error( request,
@@ -330,7 +330,8 @@ class PaymentOrderView(FormView):
     def get_context_data(self, **kwargs):
         context = super(PaymentOrderView, self).get_context_data(**kwargs)
         context.update({
-            'stripe_key': settings.STRIPE_API_PUBLIC_KEY
+            'stripe_key': settings.STRIPE_API_PUBLIC_KEY,
+            'site_url': reverse('datacenterlight:index')
         })
         return context
 
@@ -393,6 +394,7 @@ class OrderConfirmationView(DetailView):
         stripe_utils = StripeUtils()
         card_details = stripe_utils.get_card_details(customer.stripe_id, request.session.get('token'))
         context = {
+            'site_url': reverse('datacenterlight:index'),
             'cc_last4' : card_details.get('response_object').get('last4'),
             'cc_brand' : card_details.get('response_object').get('brand')
         }
diff --git a/hosting/templates/hosting/base_short.html b/hosting/templates/hosting/base_short.html
index e1a6a027..c1ba46b1 100644
--- a/hosting/templates/hosting/base_short.html
+++ b/hosting/templates/hosting/base_short.html
@@ -57,7 +57,7 @@
                     <span class="icon-bar"></span>
                     <span class="icon-bar"></span>
                 </button>
-                <a class="navbar-brand topnav" href="{{ request.session.hosting_url}}"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a>
+                <a class="navbar-brand topnav" href="{% if site_url %}{{site_url}}{% else %}{{ request.session.hosting_url}}{% endif %}"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a>
             </div>
             {% if request.user.is_authenticated %}
             <!-- Collect the nav links, forms, and other content for toggling -->