Fix custom special views 403,404 to return the right HTTP code

This commit is contained in:
Skia 2016-05-02 11:33:38 +02:00
parent 08ae6a19bc
commit 9c0b17a9ae

View File

@ -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):