fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed another bug in shelves.
[wolnelektury.git]
/
apps
/
catalogue
/
models.py
diff --git
a/apps/catalogue/models.py
b/apps/catalogue/models.py
index
b658676
..
133440b
100644
(file)
--- a/
apps/catalogue/models.py
+++ b/
apps/catalogue/models.py
@@
-202,7
+202,8
@@
class Book(models.Model):
short_text = ''
if (len(MarkupString(text)) > 240):
short_text = unicode(MarkupString(text)[:160])
short_text = ''
if (len(MarkupString(text)) > 240):
short_text = unicode(MarkupString(text)[:160])
- new_fragment = Fragment(text=text, short_text=short_text, anchor=fragment.id, book=book)
+ new_fragment, created = Fragment.objects.get_or_create(anchor=fragment.id, book=book,
+ defaults={'text': text, 'short_text': short_text})
try:
theme_names = [s.strip() for s in fragment.themes.split(',')]
try:
theme_names = [s.strip() for s in fragment.themes.split(',')]