switch de publico

parent 99fc8d33
......@@ -2,7 +2,7 @@ from django.shortcuts import HttpResponseRedirect
from django.urls import reverse
# from django.core.urlresolvers import reverse
from catalog.models import Publics
from catalog.models import Publics, Purchase
class AuthRequiredMiddleware(object):
......@@ -14,8 +14,19 @@ class AuthRequiredMiddleware(object):
# the view (and later middleware) are called.
response = self.get_response(request)
#if "/reports/" in request.path_info and "/scl_data" in request.path_info and purchase:
if "/reports/" in request.path_info and "/scl_data" in request.path_info:
print (request.path_info)
purchase_id = request.path_info.replace("/reports/", "")
purchase_id = purchase_id.replace("/scl_data", "")
purchase = Purchase.objects.filter(pk=purchase_id, is_public=True)
if purchase:
print ("si")
else:
return HttpResponseRedirect(reverse('login'))
elif request.path_info == reverse('ipn'):
print(request.path_info)
elif not request.user.is_authenticated and request.path_info != reverse('login') and not request.user.is_active:
......
......@@ -31,7 +31,7 @@
<div class="wrmapper">
<header class="main-header">
<!-- Logo -->
<a href="{{ BASE_URL }}/catalog" class="logo">
<a {% if request.user.is_authenticated %}href="{{ BASE_URL }}/catalog" {% else %} href="../../../" {% endif %}class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>G</b>eo</span>
<!-- logo for regular state and mobile devices -->
......
......@@ -51,7 +51,7 @@ def report_L2ASCL(request, report, purchase_id):
#print(datasets)
if report == 'scl_data':
template = "sclData.html"
reporteDir='mask'
folders=""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment