Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AE UTBM
Sith
Commits
9c0b17a9
Commit
9c0b17a9
authored
May 02, 2016
by
Skia
🤘
Browse files
Fix custom special views 403,404 to return the right HTTP code
parent
08ae6a19
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/views/__init__.py
View file @
9c0b17a9
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.views.generic.base
import
View
from
core.models
import
Group
def
forbidden
(
request
):
return
render
(
request
,
"core/403.jinja"
)
return
HttpResponseForbidden
(
render
(
request
,
"core/403.jinja"
)
)
def
not_found
(
request
):
return
render
(
request
,
"core/404.jinja"
)
return
HttpResponseNotFound
(
render
(
request
,
"core/404.jinja"
)
)
def
can_edit_prop
(
obj
,
user
):
if
obj
is
None
or
user
.
is_owner
(
obj
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment