MCPcopy
hub / github.com/django/django / inner

Method inner

django/contrib/admin/sites.py:235–248  ·  view source on GitHub ↗
(request, *args, **kwargs)

Source from the content-addressed store, hash-verified

233 """
234
235 def inner(request, *args, **kwargs):
236 if not self.has_permission(request):
237 if request.path == reverse("admin:logout", current_app=self.name):
238 index_path = reverse("admin:index", current_app=self.name)
239 return HttpResponseRedirect(index_path)
240 # Inner import to prevent django.contrib.admin (app) from
241 # importing django.contrib.auth.models.User (unrelated model).
242 from django.contrib.auth.views import redirect_to_login
243
244 return redirect_to_login(
245 request.get_full_path(),
246 reverse("admin:login", current_app=self.name),
247 )
248 return view(request, *args, **kwargs)
249
250 if not cacheable:
251 inner = never_cache(inner)

Callers

nothing calls this directly

Calls 6

has_permissionMethod · 0.95
reverseFunction · 0.90
redirect_to_loginFunction · 0.90
viewFunction · 0.85
get_full_pathMethod · 0.80

Tested by

no test coverage detected