From: Marcin Koziej Date: Fri, 30 Dec 2011 12:08:29 +0000 (+0100) Subject: Merge branch 'pretty' of github.com:fnp/wolnelektury into pretty X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/02b46ac5bb9ae5301e4764b9c111c971aa86b333?ds=inline Merge branch 'pretty' of github.com:fnp/wolnelektury into pretty Conflicts: apps/catalogue/urls.py apps/catalogue/views.py --- 02b46ac5bb9ae5301e4764b9c111c971aa86b333 diff --cc apps/catalogue/urls.py index dce1b8f10,b6fd3610f..4baf225a5 --- a/apps/catalogue/urls.py +++ b/apps/catalogue/urls.py @@@ -6,8 -6,10 +6,11 @@@ from django.conf.urls.defaults import from catalogue.feeds import AudiobookFeed from catalogue.models import Book from picture.models import Picture +from catalogue.views import CustomPDFFormView + + SLUG = r'[a-z0-9-]*' + urlpatterns = patterns('picture.views', # pictures - currently pictures are coupled with catalogue, hence the url is here url(r'^obraz/?$', 'picture_list'), @@@ -47,6 -49,6 +50,7 @@@ url(r'^audiobooki/(?Pmp3|ogg|daisy|all).xml$', AudiobookFeed(), name='audiobook_feed'), - url(r'^custompdf/(?P%s).pdf' % Book.FILEID_RE, 'download_custom_pdf'), - url(r'^custompdf$', CustomPDFFormView(), name='custom_pdf_form') ++ url(r'^custompdf$', CustomPDFFormView(), name='custom_pdf_form'), + url(r'^custompdf/(?P%s).pdf' % SLUG, 'download_custom_pdf'), + ) diff --cc apps/catalogue/views.py index d80e570bc,3a3283229..b874c4c0a --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@@ -200,15 -196,12 +197,12 @@@ def book_fragments(request, slug, theme context_instance=RequestContext(request)) - def book_detail(request, book): - kwargs = models.Book.split_urlid(book) - if kwargs is None: - raise Http404 + def book_detail(request, slug): try: - book = models.Book.objects.get(**kwargs) + book = models.Book.objects.get(slug=slug) except models.Book.DoesNotExist: return pdcounter_views.book_stub_detail(request, kwargs['slug']) - + book_tag = book.book_tag() tags = list(book.tags.filter(~Q(category='set'))) categories = split_tags(tags) @@@ -726,14 -704,11 +705,11 @@@ def download_zip(request, format, slug= return HttpResponseRedirect(urlquote_plus(settings.MEDIA_URL + url, safe='/?=')) - def download_custom_pdf(request, book_fileid, method='GET'): - kwargs = models.Book.split_fileid(book_fileid) - if kwargs is None: - raise Http404 - book = get_object_or_404(models.Book, **kwargs) -def download_custom_pdf(request, slug): ++def download_custom_pdf(request, slug, method='GET'): + book = get_object_or_404(models.Book, slug=slug) - if request.method == 'GET': - form = forms.CustomPDFForm(request.GET) + if request.method == method: + form = forms.CustomPDFForm(method == 'GET' and request.GET or request.POST) if form.is_valid(): cust = form.customizations pdf_file = models.get_customized_pdf_path(book, cust) diff --cc lib/librarian index 5fed78856,a34b95aa7..cbabbdaa7 --- a/lib/librarian +++ b/lib/librarian @@@ -1,1 -1,1 +1,1 @@@ - Subproject commit 5fed78856949474a36bc5e268517775a9a802e27 -Subproject commit a34b95aa7ba5fd4838541d1cdcd28358fb808062 ++Subproject commit cbabbdaa7ab6c6be8cd22b77860331444ddf6119