descripcion reportes

parent 24cd2296
...@@ -125,6 +125,15 @@ AUTH_PASSWORD_VALIDATORS = [ ...@@ -125,6 +125,15 @@ AUTH_PASSWORD_VALIDATORS = [
] ]
#Impersonate
IMPERSONATE = {
'REDIRECT_URL': '/administration/users/',
}
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/ # https://docs.djangoproject.com/en/1.11/topics/i18n/
......
import re import re
from django.shortcuts import HttpResponseRedirect from django.shortcuts import HttpResponseRedirect, redirect
from django.urls import reverse from django.urls import reverse
# from django.core.urlresolvers import reverse # from django.core.urlresolvers import reverse
...@@ -15,9 +15,6 @@ class AuthRequiredMiddleware(object): ...@@ -15,9 +15,6 @@ class AuthRequiredMiddleware(object):
# the view (and later middleware) are called. # the view (and later middleware) are called.
response = self.get_response(request) response = self.get_response(request)
print ('midleware response',response)
if "/reports/" in request.path_info and not request.user.is_authenticated: if "/reports/" in request.path_info and not request.user.is_authenticated:
if re.match("^(?:\/reports\/)+[0-9]*$", request.path_info): if re.match("^(?:\/reports\/)+[0-9]*$", request.path_info):
purchase_id = request.path_info.replace("/reports/", "") purchase_id = request.path_info.replace("/reports/", "")
...@@ -36,7 +33,8 @@ class AuthRequiredMiddleware(object): ...@@ -36,7 +33,8 @@ class AuthRequiredMiddleware(object):
elif "/impersonate/" in request.path_info: elif "/impersonate/" in request.path_info:
return response return response
elif "/impersonate/stop/" in request.path_info:
return redirect('/administration/users/')
elif request.path_info == reverse('ipn'): elif request.path_info == reverse('ipn'):
return response return response
elif not request.user.is_authenticated and request.path_info != reverse('login') and not request.user.is_active: elif not request.user.is_authenticated and request.path_info != reverse('login') and not request.user.is_active:
......
...@@ -7,4 +7,4 @@ view_as{ ...@@ -7,4 +7,4 @@ view_as{
margin-top: 0px !important; margin-top: 0px !important;
background-color: rgba(255, 0, 0, 0.5); background-color: rgba(255, 0, 0, 0.5);
text-align: center; text-align: center;
} }
\ No newline at end of file \ No newline at end of file
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