fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
missing piwik tags
[wolnelektury.git]
/
apps
/
catalogue
/
models.py
diff --git
a/apps/catalogue/models.py
b/apps/catalogue/models.py
index
b78b593
..
4552962
100644
(file)
--- a/
apps/catalogue/models.py
+++ b/
apps/catalogue/models.py
@@
-160,12
+160,15
@@
def book_upload_path(ext=None, maxlen=100):
def get_dynamic_path(media, filename, ext=ext):
# how to put related book's slug here?
if not ext:
def get_dynamic_path(media, filename, ext=ext):
# how to put related book's slug here?
if not ext:
- ext = media.type
+ if media.type == 'daisy':
+ ext = 'daisy.zip'
+ else:
+ ext = media.type
if not media.name:
name = slughifi(filename.split(".")[0])
else:
name = slughifi(media.name)
if not media.name:
name = slughifi(filename.split(".")[0])
else:
name = slughifi(media.name)
- return 'lektura/%s.%s' % (name[:
(maxlen-len('lektura/.%s' % ext))
], ext)
+ return 'lektura/%s.%s' % (name[:
maxlen-len('lektura/.%s' % ext)-4
], ext)
return get_dynamic_path
return get_dynamic_path
@@
-555,7
+558,7
@@
class Book(models.Model):
tag.save()
book_tags.append(tag)
tag.save()
book_tags.append(tag)
- book.tags =
book_tags + book_shelves
+ book.tags =
set(book_tags + book_shelves)
book_tag = book.book_tag()
book_tag = book.book_tag()