Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AE UTBM
Sith
Commits
7b093f6f
Commit
7b093f6f
authored
Nov 24, 2015
by
Skia
Browse files
Fix page table integrity
parent
ce8ceb80
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/models.py
View file @
7b093f6f
...
...
@@ -120,6 +120,7 @@ class Page(models.Model):
query, but don't rely on it when playing with a Page object, use get_full_name() instead!
"""
name
=
models
.
CharField
(
_
(
'page name'
),
max_length
=
30
,
blank
=
False
)
# TODO: move title and content to PageRev class with a OneToOne field
title
=
models
.
CharField
(
_
(
"page title"
),
max_length
=
255
,
blank
=
True
)
content
=
models
.
TextField
(
_
(
"page content"
),
blank
=
True
)
revision
=
models
.
PositiveIntegerField
(
_
(
"current revision"
),
default
=
1
)
...
...
@@ -163,7 +164,10 @@ class Page(models.Model):
self
.
full_clean
()
# This reset the full_name just before saving to maintain a coherent field quicker for queries than the
# recursive method
# It also update all the children to maintain correct names
self
.
full_name
=
self
.
get_full_name
()
for
c
in
self
.
children
.
all
():
c
.
save
()
super
(
Page
,
self
).
save
(
*
args
,
**
kwargs
)
def
__str__
(
self
):
...
...
Write
Preview
Supports
Markdown
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