mamweb/various/views/csrf.py

12 lines
371 B
Python
Raw Normal View History

2023-10-09 22:02:05 +02:00
from django.http import HttpResponseForbidden
from django.shortcuts import render
2023-10-09 21:50:50 +02:00
def csrf_error(request, reason=""):
""" Jednoduchý „template view“ (třída to být nemůže) pro CSRF chyby """
2023-10-09 21:50:50 +02:00
return render(
request, 'various/403_csrf.html',
{"url": request.META.get("HTTP_REFERER", None), "reason": reason},
2023-10-09 22:02:05 +02:00
status=HttpResponseForbidden.status_code,
2023-10-09 21:50:50 +02:00
)