X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/85b2f0f3f639c54c199162d07b7027ce3412c996..87ff3f803d2f147e6fa939a99c4c4a4ca6aa965f:/apps/catalogue/views.py diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index 168645009..7ead47115 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -15,7 +15,7 @@ from django.contrib.auth.decorators import login_required, user_passes_test from django.utils.datastructures import SortedDict from django.utils.http import urlquote_plus from django.utils import translation -from django.utils.translation import ugettext as _ +from django.utils.translation import ugettext as _, ugettext_lazy from django.views.decorators.cache import never_cache from ajaxable.utils import JSONResponse, AjaxableFormView @@ -246,10 +246,11 @@ def player(request, slug): else: have_oggs = False audiobooks.append(media) - print audiobooks projects = sorted(projects) + extra_info = book.get_extra_info_value() + return render_to_response('catalogue/player.html', locals(), context_instance=RequestContext(request)) @@ -551,17 +552,22 @@ def download_custom_pdf(request, slug, method='GET'): class CustomPDFFormView(AjaxableFormView): form_class = forms.CustomPDFForm - title = _('Download custom PDF') - submit = _('Download') + title = ugettext_lazy('Download custom PDF') + submit = ugettext_lazy('Download') def __call__(self, request): from copy import copy if request.method == 'POST': request.GET = copy(request.GET) - request.GET['next'] = "%s?%s" % (reverse('catalogue.views.download_custom_pdf', args=[request.GET['slug']]), + request.GET['next'] = "%s?%s" % (reverse('catalogue.views.download_custom_pdf', args=[request.GET.get('slug')]), request.POST.urlencode()) return super(CustomPDFFormView, self).__call__(request) + def get_object(self, request): + return get_object_or_404(models.Book, slug=request.GET.get('slug')) + + def context_description(self, request, obj): + return obj.pretty_title() def success(self, *args): pass