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
db73b510
Commit
db73b510
authored
Feb 14, 2013
by
benjaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redirect for delete view to parent
parent
dcf7e721
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
wiki/views/article.py
+13
-14
No files found.
wiki/views/article.py
View file @
db73b510
...
...
@@ -126,21 +126,20 @@ class Delete(FormView, ArticleMixin):
therefore it is separate."""
urlpath
=
kwargs
.
get
(
'urlpath'
,
None
)
# Where to go after deletion...
self
.
next
=
request
.
GET
.
get
(
'next'
,
None
)
self
.
next
=
""
self
.
cannot_delete_root
=
False
if
not
self
.
next
:
if
urlpath
and
urlpath
.
parent
:
self
.
next
=
reverse
(
'wiki:get'
,
kwargs
=
{
'path'
:
urlpath
.
parent
.
path
})
elif
urlpath
:
# We are a urlpath with no parent. This is the root
self
.
cannot_delete_root
=
True
else
:
# We have no urlpath. Get it if a urlpath exists
for
art_obj
in
article
.
articleforobject_set
.
filter
(
is_mptt
=
True
):
if
art_obj
.
content_object
.
parent
:
self
.
next
=
reverse
(
'wiki:get'
,
kwargs
=
{
'article_id'
:
art_obj
.
content_object
.
parent
.
article
.
id
})
else
:
self
.
cannot_delete_root
=
True
if
urlpath
and
urlpath
.
parent
:
self
.
next
=
reverse
(
'wiki:get'
,
kwargs
=
{
'path'
:
urlpath
.
parent
.
path
})
elif
urlpath
:
# We are a urlpath with no parent. This is the root
self
.
cannot_delete_root
=
True
else
:
# We have no urlpath. Get it if a urlpath exists
for
art_obj
in
article
.
articleforobject_set
.
filter
(
is_mptt
=
True
):
if
art_obj
.
content_object
.
parent
:
self
.
next
=
reverse
(
'wiki:get'
,
kwargs
=
{
'article_id'
:
art_obj
.
content_object
.
parent
.
article
.
id
})
else
:
self
.
cannot_delete_root
=
True
return
super
(
Delete
,
self
)
.
dispatch
(
request
,
article
,
*
args
,
**
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