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
bf0d9cd8
Commit
bf0d9cd8
authored
Aug 22, 2012
by
benjaoming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:benjaoming/django-wiki
parents
b03a317c
9865b5c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
17 deletions
+26
-17
wiki/templates/wiki/preview_inline.html
+8
-1
wiki/views/article.py
+18
-16
No files found.
wiki/templates/wiki/preview_inline.html
View file @
bf0d9cd8
...
@@ -21,6 +21,13 @@
...
@@ -21,6 +21,13 @@
<h1
class=
"page-header"
>
{{ title }}
</h1>
<h1
class=
"page-header"
>
{{ title }}
</h1>
{% wiki_render article content %}
{% if revision and revision.deleted %}
<div
class=
"warning"
>
<strong>
This revision has been deleted.
</strong>
<p>
Restoring to this revision will mark the article as deleted.
</p>
</div>
{% else %}
{% wiki_render article content %}
{% endif %}
{% endblock %}
{% endblock %}
wiki/views/article.py
View file @
bf0d9cd8
...
@@ -146,7 +146,7 @@ class Delete(FormView, ArticleMixin):
...
@@ -146,7 +146,7 @@ class Delete(FormView, ArticleMixin):
def
get_form
(
self
,
form_class
):
def
get_form
(
self
,
form_class
):
form
=
super
(
Delete
,
self
)
.
get_form
(
form_class
)
form
=
super
(
Delete
,
self
)
.
get_form
(
form_class
)
if
self
.
article
.
can_
dele
te
(
self
.
request
.
user
):
if
self
.
article
.
can_
modera
te
(
self
.
request
.
user
):
form
.
fields
[
'purge'
]
.
widget
=
forms
.
forms
.
CheckboxInput
()
form
.
fields
[
'purge'
]
.
widget
=
forms
.
forms
.
CheckboxInput
()
return
form
return
form
...
@@ -332,20 +332,22 @@ class Deleted(Delete):
...
@@ -332,20 +332,22 @@ class Deleted(Delete):
return
redirect
(
'wiki:get'
,
article_id
=
article
.
id
)
return
redirect
(
'wiki:get'
,
article_id
=
article
.
id
)
# Restore
# Restore
if
(
request
.
GET
.
get
(
'restore'
,
False
)
and
if
request
.
GET
.
get
(
'restore'
,
False
):
(
not
article
.
current_revision
.
locked
and
article
.
can_delete
(
request
.
user
))
or
can_restore
=
not
article
.
current_revision
.
locked
and
article
.
can_delete
(
request
.
user
)
article
.
can_moderate
(
request
.
user
)):
can_restore
=
can_restore
or
article
.
can_moderate
(
request
.
user
)
revision
=
models
.
ArticleRevision
()
revision
.
inherit_predecessor
(
self
.
article
)
if
can_restore
:
revision
.
set_from_request
(
request
)
revision
=
models
.
ArticleRevision
()
revision
.
deleted
=
False
revision
.
inherit_predecessor
(
self
.
article
)
revision
.
automatic_log
=
_
(
'Restoring article'
)
revision
.
set_from_request
(
request
)
self
.
article
.
add_revision
(
revision
)
revision
.
deleted
=
False
messages
.
success
(
request
,
_
(
u'The article "
%
s" and its children are now restored.'
)
%
revision
.
title
)
revision
.
automatic_log
=
_
(
'Restoring article'
)
if
self
.
urlpath
:
self
.
article
.
add_revision
(
revision
)
return
redirect
(
'wiki:get'
,
path
=
self
.
urlpath
.
path
)
messages
.
success
(
request
,
_
(
u'The article "
%
s" and its children are now restored.'
)
%
revision
.
title
)
else
:
if
self
.
urlpath
:
return
redirect
(
'wiki:get'
,
article_id
=
article
.
id
)
return
redirect
(
'wiki:get'
,
path
=
self
.
urlpath
.
path
)
else
:
return
redirect
(
'wiki:get'
,
article_id
=
article
.
id
)
return
super
(
Deleted
,
self
)
.
dispatch1
(
request
,
article
,
*
args
,
**
kwargs
)
return
super
(
Deleted
,
self
)
.
dispatch1
(
request
,
article
,
*
args
,
**
kwargs
)
...
@@ -518,7 +520,7 @@ class Preview(ArticleMixin, TemplateView):
...
@@ -518,7 +520,7 @@ class Preview(ArticleMixin, TemplateView):
template_name
=
"wiki/preview_inline.html"
template_name
=
"wiki/preview_inline.html"
@method_decorator
(
get_article
(
can_read
=
True
))
@method_decorator
(
get_article
(
can_read
=
True
,
deleted_contents
=
True
))
def
dispatch
(
self
,
request
,
article
,
*
args
,
**
kwargs
):
def
dispatch
(
self
,
request
,
article
,
*
args
,
**
kwargs
):
revision_id
=
request
.
GET
.
get
(
'r'
,
None
)
revision_id
=
request
.
GET
.
get
(
'r'
,
None
)
self
.
title
=
None
self
.
title
=
None
...
...
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