Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-wiki
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-wiki
Commits
3e7ddf6a
Commit
3e7ddf6a
authored
Aug 17, 2012
by
benjaoming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:benjaoming/django-wiki
parents
1d3677b3
473fd5ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
wiki/decorators.py
+6
-5
wiki/templates/wiki/permission_denied.html
+13
-0
No files found.
wiki/decorators.py
View file @
3e7ddf6a
# -*- coding: utf-8 -*-
from
django.conf
import
settings
as
django_settings
from
django.core.urlresolvers
import
reverse
from
django.shortcuts
import
redirect
,
get_object_or_404
from
django.shortcuts
import
redirect
,
get_object_or_404
,
render_to_response
from
django.template.context
import
RequestContext
from
django.http
import
HttpResponse
,
HttpResponseNotFound
from
django.utils
import
simplejson
as
json
...
...
@@ -94,15 +95,15 @@ def get_article(func=None, can_read=True, can_write=False, deleted_contents=Fals
if
request
.
user
.
is_anonymous
():
return
redirect
(
django_settings
.
LOGIN_URL
)
else
:
pass
# TODO: Return a permission denied page
c
=
RequestContext
(
request
,
{
'urlpath'
:
urlpath
})
return
render_to_response
(
"wiki/permission_denied.html"
,
context_instance
=
c
)
if
can_write
and
not
article
.
can_write
(
request
.
user
):
if
request
.
user
.
is_anonymous
():
return
redirect
(
django_settings
.
LOGIN_URL
)
else
:
pass
# TODO: Return a permission denied page
c
=
RequestContext
(
request
,
{
'urlpath'
:
urlpath
})
return
render_to_response
(
"wiki/permission_denied.html"
,
context_instance
=
c
)
# If the article has been deleted, show a special page.
if
not
deleted_contents
and
article
.
current_revision
and
article
.
current_revision
.
deleted
:
...
...
wiki/templates/wiki/permission_denied.html
0 → 100644
View file @
3e7ddf6a
{% extends "wiki/base.html" %}
{% load wiki_tags i18n %}
{% load url from future %}
{% block pagetitle %}Permission Denied{% endblock %}
{% block wiki_contents %}
<div
class=
"alert denied"
>
<h1>
Permission Denied
</h2>
<p>
Sorry, you don't have permission to view this page.
</p>
</div>
{% endblock %}
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