fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added button to fold unfolded category list on main page.
[wolnelektury.git]
/
apps
/
catalogue
/
models.py
diff --git
a/apps/catalogue/models.py
b/apps/catalogue/models.py
index
30131bd
..
133440b
100644
(file)
--- a/
apps/catalogue/models.py
+++ b/
apps/catalogue/models.py
@@
-97,6
+97,10
@@
class Book(models.Model):
tagged = managers.ModelTaggedItemManager(Tag)
tags = managers.TagDescriptor(Tag)
tagged = managers.ModelTaggedItemManager(Tag)
tags = managers.TagDescriptor(Tag)
+ @property
+ def name(self):
+ return self.title
+
def short_html(self):
if len(self._short_html):
return mark_safe(self._short_html)
def short_html(self):
if len(self._short_html):
return mark_safe(self._short_html)
@@
-111,8
+115,8
@@
class Book(models.Model):
formats.append(u'<a href="%s">Plik PDF</a>' % self.pdf_file.url)
if self.odt_file:
formats.append(u'<a href="%s">Plik ODT</a>' % self.odt_file.url)
formats.append(u'<a href="%s">Plik PDF</a>' % self.pdf_file.url)
if self.odt_file:
formats.append(u'<a href="%s">Plik ODT</a>' % self.odt_file.url)
- if self.
od
t_file:
- formats.
+ if self.
tx
t_file:
+ formats.
append(u'<a href="%s">Plik TXT</a>' % self.txt_file.url)
self._short_html = unicode(render_to_string('catalogue/book_short.html',
{'book': self, 'tags': tags, 'formats': formats}))
self._short_html = unicode(render_to_string('catalogue/book_short.html',
{'book': self, 'tags': tags, 'formats': formats}))
@@
-198,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(',')]