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
ce4fd7a8
Commit
ce4fd7a8
authored
Aug 21, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the lost and found until it can be debugged.
parent
4ddc7cbd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
36 deletions
+37
-36
wiki/models/urlpath.py
+37
-36
No files found.
wiki/models/urlpath.py
View file @
ce4fd7a8
...
@@ -214,39 +214,40 @@ def on_article_relation_save(instance, *args, **kwargs):
...
@@ -214,39 +214,40 @@ def on_article_relation_save(instance, *args, **kwargs):
post_save
.
connect
(
on_article_relation_save
,
ArticleForObject
)
post_save
.
connect
(
on_article_relation_save
,
ArticleForObject
)
def
on_article_delete
(
instance
,
*
args
,
**
kwargs
):
# TODO: When a parent all of its children are purged, they get sucked up into the lost and found. It is disabled for now.
# If an article is deleted, then throw out its URLPaths
# def on_article_delete(instance, *args, **kwargs):
# But move all descendants to a lost-and-found node.
# # If an article is deleted, then throw out its URLPaths
site
=
Site
.
objects
.
get_current
()
# # But move all descendants to a lost-and-found node.
# site = Site.objects.get_current()
# Get the Lost-and-found path or create a new one
#
try
:
# # Get the Lost-and-found path or create a new one
lost_and_found
=
URLPath
.
objects
.
get
(
slug
=
settings
.
LOST_AND_FOUND_SLUG
,
# try:
parent
=
URLPath
.
root
(),
# lost_and_found = URLPath.objects.get(slug=settings.LOST_AND_FOUND_SLUG,
site
=
site
)
# parent=URLPath.root(),
except
URLPath
.
DoesNotExist
:
# site=site)
article
=
Article
(
group_read
=
True
,
# except URLPath.DoesNotExist:
group_write
=
False
,
# article = Article(group_read = True,
other_read
=
False
,
# group_write = False,
other_write
=
False
)
# other_read = False,
article
.
add_revision
(
ArticleRevision
(
# other_write = False)
content
=
_
(
u'Articles who lost their parents
\n
'
# article.add_revision(ArticleRevision(
'===============================
\n\n
'
# content=_(u'Articles who lost their parents\n'
'The children of this article have had their parents deleted. You should probably find a new home for them.'
),
# '===============================\n\n'
title
=
_
(
u"Lost and found"
)))
# 'The children of this article have had their parents deleted. You should probably find a new home for them.'),
lost_and_found
=
URLPath
.
objects
.
create
(
slug
=
settings
.
LOST_AND_FOUND_SLUG
,
# title=_(u"Lost and found")))
parent
=
URLPath
.
root
(),
# lost_and_found = URLPath.objects.create(slug=settings.LOST_AND_FOUND_SLUG,
site
=
site
,
# parent=URLPath.root(),
article
=
article
)
# site=site,
article
.
add_object_relation
(
lost_and_found
)
# article=article)
# article.add_object_relation(lost_and_found)
#
for
urlpath
in
URLPath
.
objects
.
filter
(
articles__article
=
instance
,
site
=
site
):
#
# Delete the children
# for urlpath in URLPath.objects.filter(articles__article=instance, site=site):
for
child
in
urlpath
.
get_children
():
# # Delete the children
child
.
move_to
(
lost_and_found
)
# for child in urlpath.get_children():
# ...and finally delete the path itself
# child.move_to(lost_and_found)
# TODO: This should be unnecessary because of URLPath.article(...ondelete=models.CASCADE)
# # ...and finally delete the path itself
urlpath
.
delete
()
# # TODO: This should be unnecessary because of URLPath.article(...ondelete=models.CASCADE)
# urlpath.delete()
pre_delete
.
connect
(
on_article_delete
,
Article
)
#
# pre_delete.connect(on_article_delete, Article)
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