from django.template.loader import render_to_string
from django.shortcuts import get_object_or_404, render, redirect
from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponsePermanentRedirect
from django.template.loader import render_to_string
from django.shortcuts import get_object_or_404, render, redirect
from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponsePermanentRedirect
from annoy.models import DynamicTextInsert
from pdcounter import views as pdcounter_views
from picture.models import Picture, PictureArea
from annoy.models import DynamicTextInsert
from pdcounter import views as pdcounter_views
from picture.models import Picture, PictureArea
from catalogue.models import Book, Collection, Tag, Fragment
from catalogue.utils import split_tags
from catalogue.models.tag import prefetch_relations
from catalogue.models import Book, Collection, Tag, Fragment
from catalogue.utils import split_tags
from catalogue.models.tag import prefetch_relations
return render(request, 'catalogue/catalogue.html', {
'books': Book.objects.filter(findable=True, parent=None),
'pictures': Picture.objects.all(),
return render(request, 'catalogue/catalogue.html', {
'books': Book.objects.filter(findable=True, parent=None),
'pictures': Picture.objects.all(),
def collection(request, slug):
coll = get_object_or_404(Collection, slug=slug)
def collection(request, slug):
coll = get_object_or_404(Collection, slug=slug)
- return render(request, 'catalogue/collection.html', {'collection': coll})
+ return render(request, 'catalogue/collection.html', {
+ 'collection': coll,
+ 'active_menu_item': 'collections',
+ })
'book': book,
'book_children': book.children.all().order_by('parent_number', 'sort_key'),
'active_menu_item': 'books',
'book': book,
'book_children': book.children.all().order_by('parent_number', 'sort_key'),
'active_menu_item': 'books',
_("An error occurred: %(exception)s\n\n%(tb)s") % {
'exception': exception, 'tb': tb
},
_("An error occurred: %(exception)s\n\n%(tb)s") % {
'exception': exception, 'tb': tb
},
)
return HttpResponse(_("Book imported successfully"))
return HttpResponse(_("Error importing file: %r") % book_import_form.errors)
)
return HttpResponse(_("Book imported successfully"))
return HttpResponse(_("Error importing file: %r") % book_import_form.errors)