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
5600743f
Commit
5600743f
authored
Jul 25, 2017
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.9 upgrades
From
https://github.com/django-wiki/django-wiki/pull/508
parent
2eeedf8b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
9 deletions
+47
-9
wiki/plugins/attachments/views.py
+13
-0
wiki/plugins/images/views.py
+8
-0
wiki/views/article.py
+26
-9
No files found.
wiki/plugins/attachments/views.py
View file @
5600743f
...
...
@@ -55,6 +55,11 @@ class AttachmentView(ArticleMixin, FormView):
return
redirect
(
"wiki:attachments_index"
,
path
=
self
.
urlpath
.
path
,
article_id
=
self
.
article
.
id
)
def
get_context_data
(
self
,
**
kwargs
):
# Needed since Django 1.9 because get_context_data is no longer called
# with the form instance
if
'form'
not
in
kwargs
:
kwargs
[
'form'
]
=
self
.
get_form
()
kwargs
[
'attachments'
]
=
self
.
attachments
kwargs
[
'search_form'
]
=
forms
.
SearchForm
()
kwargs
[
'selected_tab'
]
=
'attachments'
...
...
@@ -127,6 +132,8 @@ class AttachmentReplaceView(ArticleMixin, FormView):
return
{
'description'
:
self
.
attachment
.
current_revision
.
description
}
def
get_context_data
(
self
,
**
kwargs
):
if
'form'
not
in
kwargs
:
kwargs
[
'form'
]
=
self
.
get_form
()
kwargs
[
'attachment'
]
=
self
.
attachment
kwargs
[
'selected_tab'
]
=
'attachments'
return
super
(
AttachmentReplaceView
,
self
)
.
get_context_data
(
**
kwargs
)
...
...
@@ -178,6 +185,8 @@ class AttachmentChangeRevisionView(ArticleMixin, View):
def
get_context_data
(
self
,
**
kwargs
):
kwargs
[
'selected_tab'
]
=
'attachments'
if
'form'
not
in
kwargs
:
kwargs
[
'form'
]
=
self
.
get_form
()
return
ArticleMixin
.
get_context_data
(
self
,
**
kwargs
)
class
AttachmentAddView
(
ArticleMixin
,
View
):
...
...
@@ -231,6 +240,8 @@ class AttachmentDeleteView(ArticleMixin, FormView):
def
get_context_data
(
self
,
**
kwargs
):
kwargs
[
'attachment'
]
=
self
.
attachment
kwargs
[
'selected_tab'
]
=
'attachments'
if
'form'
not
in
kwargs
:
kwargs
[
'form'
]
=
self
.
get_form
()
return
super
(
AttachmentDeleteView
,
self
)
.
get_context_data
(
**
kwargs
)
...
...
@@ -265,4 +276,6 @@ class AttachmentSearchView(ArticleMixin, ListView):
kwargs
.
update
(
kwargs_article
)
kwargs
.
update
(
kwargs_listview
)
kwargs
[
'selected_tab'
]
=
'attachments'
if
'form'
not
in
kwargs
:
kwargs
[
'form'
]
=
self
.
get_form
()
return
kwargs
wiki/plugins/images/views.py
View file @
5600743f
...
...
@@ -92,6 +92,10 @@ class PurgeView(ArticleMixin, FormView):
return
redirect
(
'wiki:images_index'
,
article_id
=
self
.
article_id
)
def
get_context_data
(
self
,
**
kwargs
):
# Needed since Django 1.9 because get_context_data is no longer called
# with the form instance
if
'form'
not
in
kwargs
:
kwargs
[
'form'
]
=
self
.
get_form
()
kwargs
=
ArticleMixin
.
get_context_data
(
self
,
**
kwargs
)
kwargs
.
update
(
FormView
.
get_context_data
(
self
,
**
kwargs
))
return
kwargs
...
...
@@ -141,6 +145,10 @@ class RevisionAddView(ArticleMixin, FormView):
return
kwargs
def
get_context_data
(
self
,
**
kwargs
):
# Needed since Django 1.9 because get_context_data is no longer called
# with the form instance
if
'form'
not
in
kwargs
:
kwargs
[
'form'
]
=
self
.
get_form
()
kwargs
=
super
(
RevisionAddView
,
self
)
.
get_context_data
(
**
kwargs
)
kwargs
[
'image'
]
=
self
.
image
return
kwargs
...
...
wiki/views/article.py
View file @
5600743f
...
...
@@ -99,11 +99,16 @@ class Create(FormView, ArticleMixin):
return
redirect
(
'wiki:get'
,
self
.
newpath
.
path
)
def
get_context_data
(
self
,
**
kwargs
):
kwargs
[
'parent_urlpath'
]
=
self
.
urlpath
kwargs
[
'parent_article'
]
=
self
.
article
kwargs
[
'create_form'
]
=
kwargs
.
pop
(
'form'
,
None
)
kwargs
[
'editor'
]
=
editors
.
getEditor
()
return
super
(
Create
,
self
)
.
get_context_data
(
**
kwargs
)
c
=
ArticleMixin
.
get_context_data
(
self
,
**
kwargs
)
# Needed since Django 1.9 because get_context_data is no longer called
# with the form instance
if
'form'
not
in
c
:
c
[
'form'
]
=
self
.
get_form
()
c
[
'parent_urlpath'
]
=
self
.
urlpath
c
[
'parent_article'
]
=
self
.
article
c
[
'create_form'
]
=
c
.
pop
(
'form'
,
None
)
c
[
'editor'
]
=
editors
.
getEditor
()
return
c
class
Delete
(
FormView
,
ArticleMixin
):
...
...
@@ -193,7 +198,11 @@ class Delete(FormView, ArticleMixin):
cannot_delete_children
=
False
if
self
.
children_slice
and
not
self
.
article
.
can_moderate
(
self
.
request
.
user
):
cannot_delete_children
=
True
# Needed since Django 1.9 because get_context_data is no longer called
# with the form instance
if
'form'
not
in
kwargs
:
kwargs
[
'form'
]
=
self
.
get_form
()
kwargs
[
'delete_form'
]
=
kwargs
.
pop
(
'form'
,
None
)
kwargs
[
'cannot_delete_root'
]
=
self
.
cannot_delete_root
kwargs
[
'delete_children'
]
=
self
.
children_slice
[:
20
]
...
...
@@ -202,7 +211,7 @@ class Delete(FormView, ArticleMixin):
return
super
(
Delete
,
self
)
.
get_context_data
(
**
kwargs
)
class
Edit
(
FormView
,
ArticleMixin
):
class
Edit
(
ArticleMixin
,
FormView
):
"""Edit an article and process sidebar plugins."""
form_class
=
forms
.
EditForm
...
...
@@ -283,7 +292,7 @@ class Edit(FormView, ArticleMixin):
revision
.
deleted
=
False
revision
.
set_from_request
(
self
.
request
)
self
.
article
.
add_revision
(
revision
)
messages
.
success
(
self
.
request
,
_
(
u'A new revision of the article was succesfully added.'
))
messages
.
success
(
self
.
request
,
_
(
u'A new revision of the article was succes
s
fully added.'
))
return
self
.
get_success_url
()
def
get_success_url
(
self
):
...
...
@@ -293,7 +302,11 @@ class Edit(FormView, ArticleMixin):
return
redirect
(
'wiki:get'
,
article_id
=
self
.
article
.
id
)
def
get_context_data
(
self
,
**
kwargs
):
kwargs
[
'edit_form'
]
=
kwargs
.
pop
(
'form'
,
None
)
# Needed for Django 1.9 because get_context_data is no longer called
# with the form instance
if
'form'
not
in
kwargs
:
kwargs
[
'form'
]
=
self
.
get_form
()
kwargs
[
'edit_form'
]
=
kwargs
[
'form'
]
kwargs
[
'editor'
]
=
editors
.
getEditor
()
kwargs
[
'selected_tab'
]
=
'edit'
kwargs
[
'sidebar'
]
=
self
.
sidebar
...
...
@@ -355,6 +368,10 @@ class Deleted(Delete):
return
form
def
get_context_data
(
self
,
**
kwargs
):
# Needed since Django 1.9 because get_context_data is no longer called
# with the form instance
if
'form'
not
in
kwargs
:
kwargs
[
'form'
]
=
self
.
get_form
()
kwargs
[
'purge_form'
]
=
kwargs
.
pop
(
'form'
,
None
)
return
super
(
Delete
,
self
)
.
get_context_data
(
**
kwargs
)
...
...
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