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
75a05819
Commit
75a05819
authored
Mar 08, 2013
by
benjaoming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:benjaoming/django-wiki
parents
6641ed1d
2b28521c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletions
+22
-1
README.md
+1
-0
wiki/models/article.py
+20
-0
wiki/models/urlpath.py
+1
-1
No files found.
README.md
View file @
75a05819
...
...
@@ -85,6 +85,7 @@ The following applications should be listed - NB! it's important to maintain the
'wiki.plugins.attachments',
'wiki.plugins.notifications',
'wiki.plugins.images',
'wiki.plugins.macros',
### Database
...
...
wiki/models/article.py
View file @
75a05819
...
...
@@ -4,6 +4,7 @@ from django.contrib.contenttypes import generic
from
django.contrib.auth.models
import
User
,
Group
from
django.core.cache
import
cache
from
django.db
import
models
from
django.db.models.signals
import
post_save
,
pre_delete
from
django.utils.safestring
import
mark_safe
from
django.utils.translation
import
ugettext_lazy
as
_
...
...
@@ -332,3 +333,22 @@ class ArticleRevision(BaseRevisionMixin, models.Model):
ordering
=
(
'created'
,)
unique_together
=
(
'article'
,
'revision_number'
)
######################################################
# SIGNAL HANDLERS
######################################################
# clear the ancestor cache when saving or deleting articles so things like
# article_lists will be refreshed
def
_clear_ancestor_cache
(
article
):
for
ancestor
in
article
.
ancestor_objects
():
ancestor
.
article
.
clear_cache
()
def
on_article_save_clear_cache
(
instance
,
**
kwargs
):
_clear_ancestor_cache
(
instance
)
post_save
.
connect
(
on_article_save_clear_cache
,
Article
)
def
on_article_delete_clear_cache
(
instance
,
**
kwargs
):
_clear_ancestor_cache
(
instance
)
pre_delete
.
connect
(
on_article_delete_clear_cache
,
Article
)
wiki/models/urlpath.py
View file @
75a05819
...
...
@@ -287,5 +287,5 @@ def on_article_delete(instance, *args, **kwargs):
for
child
in
urlpath
.
get_children
():
child
.
move_to
(
get_lost_and_found
())
# ...and finally delete the path itself
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