add request debug view

This commit is contained in:
Jens Langhammer 2019-03-14 18:01:27 +01:00
parent a53a269a8c
commit 96be087221
3 changed files with 28 additions and 2 deletions

View File

@ -1,7 +1,7 @@
"""passbook URL Configuration""" """passbook URL Configuration"""
from django.urls import include, path from django.urls import include, path
from passbook.admin.views import (applications, audit, factors, groups, from passbook.admin.views import (applications, audit, debug, factors, groups,
invitations, overview, policy, invitations, overview, policy,
property_mapping, providers, sources, users) property_mapping, providers, sources, users)
@ -77,5 +77,7 @@ urlpatterns = [
# Groups # Groups
path('groups/', groups.GroupListView.as_view(), name='groups'), path('groups/', groups.GroupListView.as_view(), name='groups'),
# API # API
path('api/', include('passbook.admin.api.urls')) path('api/', include('passbook.admin.api.urls')),
# Debug
path('debug/request/', debug.DebugRequestView.as_view(), name='debug-request'),
] ]

View File

@ -0,0 +1,17 @@
"""passbook administration debug views"""
from django.views.generic import TemplateView
from passbook.admin.mixins import AdminRequiredMixin
class DebugRequestView(AdminRequiredMixin, TemplateView):
"""Show debug info about request"""
template_name = 'administration/debug/request.html'
def get_context_data(self, **kwargs):
kwargs['request_dict'] = {}
for key in dir(self.request):
kwargs['request_dict'][key] = getattr(self.request, key)
return super().get_context_data(**kwargs)

View File

@ -172,6 +172,13 @@
</span> </span>
</a> </a>
</li> </li>
<li class="list-group-item {% is_active 'passbook_admin:debug-request' %}">
<a href="{% url 'passbook_admin:debug-request' %}">
<span class="list-group-item-value">
{% trans 'Debug' %}
</span>
</a>
</li>
</ul> </ul>
</div> </div>
</li> </li>