Commit 9c0b17a9 authored by Skia's avatar Skia
Browse files

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

parent 08ae6a19
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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment