403 and 404 handlers
This commit is contained in:
parent
d1923f640c
commit
684987dfd5
@ -50,6 +50,14 @@ def quirk_bold_allergens(ingredients):
|
|||||||
return ", ".join(out)
|
return ", ".join(out)
|
||||||
|
|
||||||
|
|
||||||
|
def handler403(request, exception):
|
||||||
|
return JsonResponse({'status': 'notok', 'message': 'permission denied'}, status=403)
|
||||||
|
|
||||||
|
|
||||||
|
def handler404(request, exception):
|
||||||
|
return JsonResponse({'status': 'notok', 'message': 'endpoint not found'}, status=404)
|
||||||
|
|
||||||
|
|
||||||
@auth_only
|
@auth_only
|
||||||
@ensure_csrf_cookie
|
@ensure_csrf_cookie
|
||||||
def get_list(request):
|
def get_list(request):
|
||||||
|
@ -33,3 +33,6 @@ urlpatterns = [
|
|||||||
path('signin', tikette.views.signin),
|
path('signin', tikette.views.signin),
|
||||||
path('signout', tikette.views.signout),
|
path('signout', tikette.views.signout),
|
||||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|
||||||
|
handler403 = 'tikette.views.handler403'
|
||||||
|
handler404 = 'tikette.views.handler404'
|
||||||
|
Loading…
Reference in New Issue
Block a user