class GalleryMerger(object):
def __init__(self, dest_gallery, src_gallery):
- assert isinstance(dest_gallery, str)
- assert isinstance(src_gallery, str)
self.dest = dest_gallery
self.src = src_gallery
self.dest_size = None
# 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()
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
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()
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(settings.FILEBROWSER_DIRECTORY),
+ smart_unicode(settings.IMAGE_DIR),
smart_unicode(directory))
def map_to_url(filename):
FILEBROWSER_DEFAULT_ORDER = "path_relative"
# REPOSITORY_PATH = '/Users/zuber/Projekty/platforma/files/books'
+
+# Must match FILEBROWSER_DIRECTORY
IMAGE_DIR = 'images'