mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
Fix custom special views 403,404 to return the right HTTP code
This commit is contained in:
parent
08ae6a19bc
commit
9c0b17a9ae
@ -1,16 +1,16 @@
|
|||||||
|
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.http import HttpResponseForbidden
|
from django.http import HttpResponseForbidden, HttpResponseNotFound
|
||||||
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist
|
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist
|
||||||
from django.views.generic.base import View
|
from django.views.generic.base import View
|
||||||
|
|
||||||
from core.models import Group
|
from core.models import Group
|
||||||
|
|
||||||
def forbidden(request):
|
def forbidden(request):
|
||||||
return render(request, "core/403.jinja")
|
return HttpResponseForbidden(render(request, "core/403.jinja"))
|
||||||
|
|
||||||
def not_found(request):
|
def not_found(request):
|
||||||
return render(request, "core/404.jinja")
|
return HttpResponseNotFound(render(request, "core/404.jinja"))
|
||||||
|
|
||||||
def can_edit_prop(obj, user):
|
def can_edit_prop(obj, user):
|
||||||
if obj is None or user.is_owner(obj):
|
if obj is None or user.is_owner(obj):
|
||||||
|
Loading…
Reference in New Issue
Block a user