fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f681a59
)
Fix gallery merging: support for None offsets
author
Radek Czajka
<radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 28 Nov 2012 14:00:17 +0000
(15:00 +0100)
committer
Radek Czajka
<radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 28 Nov 2012 14:00:17 +0000
(15:00 +0100)
apps/catalogue/models/book.py
patch
|
blob
|
history
apps/catalogue/tests/gallery.py
patch
|
blob
|
history
apps/wiki/views.py
patch
|
blob
|
history
redakcja/settings/common.py
patch
|
blob
|
history
diff --git
a/apps/catalogue/models/book.py
b/apps/catalogue/models/book.py
index
772634c
..
4d1b12e
100755
(executable)
--- a/
apps/catalogue/models/book.py
+++ b/
apps/catalogue/models/book.py
@@
-205,7
+205,8
@@
class Book(models.Model):
# and move the gallery starts
if gm.was_merged:
for chunk in self[len(self) - len_other:]:
# and move the gallery starts
if gm.was_merged:
for chunk in self[len(self) - len_other:]:
- chunk.gallery_start += gm.dest_size - gm.num_deleted
+ old_start = chunk.gallery_start or 1
+ chunk.gallery_start = old_start + gm.dest_size - gm.num_deleted
chunk.save()
other.delete()
chunk.save()
other.delete()
diff --git
a/apps/catalogue/tests/gallery.py
b/apps/catalogue/tests/gallery.py
index
e1f636d
..
ad0dfd7
100644
(file)
--- a/
apps/catalogue/tests/gallery.py
+++ b/
apps/catalogue/tests/gallery.py
@@
-20,8
+20,6
@@
class GalleryAppendTests(TestCase):
self.book1 = Book.create(self.user, 'book 1', slug='book1')
self.book1.chunk_set.create(number=2, title='Second chunk',
slug='book 1 / 2')
self.book1 = Book.create(self.user, 'book 1', slug='book1')
self.book1.chunk_set.create(number=2, title='Second chunk',
slug='book 1 / 2')
- c=self.book1[0]
- c.gallery_start=1
c=self.book1[1]
c.gallery_start=3
c=self.book1[1]
c.gallery_start=3
@@
-43,9
+41,6
@@
class GalleryAppendTests(TestCase):
self.book2.chunk_set.create(number=2, title='Second chunk of second book',
slug='book 2 / 2')
self.book2.chunk_set.create(number=2, title='Second chunk of second book',
slug='book 2 / 2')
- c = self.book2[0]
- c.gallery_start = 1
- c.save()
c = self.book2[1]
c.gallery_start = 3
c.save()
c = self.book2[1]
c.gallery_start = 3
c.save()
diff --git
a/apps/wiki/views.py
b/apps/wiki/views.py
index
0356d50
..
4b825e5
100644
(file)
--- a/
apps/wiki/views.py
+++ b/
apps/wiki/views.py
@@
-202,12
+202,12
@@
def gallery(request, directory):
try:
base_url = ''.join((
smart_unicode(settings.MEDIA_URL),
try:
base_url = ''.join((
smart_unicode(settings.MEDIA_URL),
- smart_unicode(settings.
FILEBROWSER_DIRECTORY
),
+ smart_unicode(settings.
IMAGE_DIR
),
smart_unicode(directory)))
base_dir = os.path.join(
smart_unicode(settings.MEDIA_ROOT),
smart_unicode(directory)))
base_dir = os.path.join(
smart_unicode(settings.MEDIA_ROOT),
- smart_unicode(settings.
FILEBROWSER_DIRECTORY
),
+ smart_unicode(settings.
IMAGE_DIR
),
smart_unicode(directory))
def map_to_url(filename):
smart_unicode(directory))
def map_to_url(filename):
diff --git
a/redakcja/settings/common.py
b/redakcja/settings/common.py
index
f6b889d
..
ec4ff7a
100644
(file)
--- a/
redakcja/settings/common.py
+++ b/
redakcja/settings/common.py
@@
-139,6
+139,8
@@
FILEBROWSER_VERSIONS_BASEDIR = 'thumbnails/'
FILEBROWSER_DEFAULT_ORDER = "path_relative"
# REPOSITORY_PATH = '/Users/zuber/Projekty/platforma/files/books'
FILEBROWSER_DEFAULT_ORDER = "path_relative"
# REPOSITORY_PATH = '/Users/zuber/Projekty/platforma/files/books'
+
+# Must match FILEBROWSER_DIRECTORY
IMAGE_DIR = 'images'
IMAGE_DIR = 'images'