- def get_directory(self):
- return "%s%s/" % (settings.IMAGE_DIR, self.object.gallery)
+
+class GalleryPackageView(GalleryMixin, PackageView):
+
+ def get_redirect_url(self, slug):
+ return reverse('catalogue_book_gallery', kwargs={'slug': slug})
+
+
+@ajax(method='get')
+def lessons_for_cybernauts(request):
+ books = Book.objects.filter(for_cybernauts=True)
+ data = []
+ for book in books:
+ try:
+ changes = book.get_current_changes()
+ time_changed = max(change.created_at for change in changes)
+ xml_url = reverse('catalogue_book_xml', args=[book.slug])
+ data.append({
+ 'slug': book.slug,
+ 'url': xml_url,
+ 'time_changed': time_changed.isoformat(),
+ })
+ except Book.NoTextError:
+ pass
+ return {'lessons': data}