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
edx
django-wiki
Commits
d263d7c5
Commit
d263d7c5
authored
Jul 25, 2017
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get_form updates
parent
f6e9011f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
wiki/views/article.py
+11
-11
No files found.
wiki/views/article.py
View file @
d263d7c5
...
...
@@ -43,11 +43,13 @@ class Create(FormView, ArticleMixin):
@method_decorator
(
get_article
(
can_write
=
True
))
def
dispatch
(
self
,
request
,
article
,
*
args
,
**
kwargs
):
return
super
(
Create
,
self
)
.
dispatch
(
request
,
article
,
*
args
,
**
kwargs
)
def
get_form
(
self
,
form_class
):
def
get_form
(
self
,
form_class
=
None
):
"""
Returns an instance of the form to be used in this view.
"""
if
form_class
is
None
:
form_class
=
self
.
get_form_class
()
kwargs
=
self
.
get_form_kwargs
()
initial
=
kwargs
.
get
(
'initial'
,
{})
initial
[
'slug'
]
=
self
.
request
.
GET
.
get
(
'slug'
,
None
)
...
...
@@ -145,9 +147,9 @@ class Delete(FormView, ArticleMixin):
def
get_initial
(
self
):
return
{
'revision'
:
self
.
article
.
current_revision
}
def
get_form
(
self
,
form_class
):
form
=
super
(
Delete
,
self
)
.
get_form
(
form_class
)
def
get_form
(
self
,
form_class
=
None
):
form
=
super
(
Delete
,
self
)
.
get_form
(
form_class
=
form_class
)
if
self
.
article
.
can_moderate
(
self
.
request
.
user
):
form
.
fields
[
'purge'
]
.
widget
=
forms
.
forms
.
CheckboxInput
()
return
form
...
...
@@ -222,12 +224,14 @@ class Edit(ArticleMixin, FormView):
self
.
sidebar_plugins
=
plugin_registry
.
get_sidebar
()
self
.
sidebar
=
[]
return
super
(
Edit
,
self
)
.
dispatch
(
request
,
article
,
*
args
,
**
kwargs
)
def
get_form
(
self
,
form_class
):
def
get_form
(
self
,
form_class
=
None
):
"""
Checks from querystring data that the edit form is actually being saved,
otherwise removes the 'data' and 'files' kwargs from form initialisation.
"""
if
form_class
is
None
:
form_class
=
self
.
get_form_class
()
kwargs
=
self
.
get_form_kwargs
()
if
self
.
request
.
POST
.
get
(
'save'
,
''
)
!=
'1'
and
self
.
request
.
POST
.
get
(
'preview'
)
!=
'1'
:
kwargs
[
'data'
]
=
None
...
...
@@ -363,10 +367,6 @@ class Deleted(Delete):
return
{
'revision'
:
self
.
article
.
current_revision
,
'purge'
:
True
}
def
get_form
(
self
,
form_class
):
form
=
super
(
Delete
,
self
)
.
get_form
(
form_class
)
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
...
...
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