From: Marcin Koziej Date: Thu, 10 May 2012 12:12:44 +0000 (+0200) Subject: menu for mas editing stage and user X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/cfc1eb85823b39e0f767909ccd3a9709a5fd0ec2?hp=755ea0d8b59e47d37b91fcbf8d58d46e1cf2f1eb menu for mas editing stage and user --- diff --git a/apps/catalogue/templates/catalogue/book_list/book.html b/apps/catalogue/templates/catalogue/book_list/book.html index 44534541..1e025e39 100755 --- a/apps/catalogue/templates/catalogue/book_list/book.html +++ b/apps/catalogue/templates/catalogue/book_list/book.html @@ -3,7 +3,7 @@ {% if book.single %} {% with book.0 as chunk %} - + [B] [c] {% trans "No books found." %}

{% endif %} - + diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index f8ff5996..16d11746 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -391,19 +391,32 @@ def chunk_edit(request, slug, chunk): @transaction.commit_on_success def chunk_mass_edit(request): if request.method == 'POST': - ids = map(int, request.POST.get('ids').split(',')) + ids = map(int, filter(lambda i: i.strip()!='', request.POST.get('ids').split(','))) chunks = map(lambda i: Chunk.objects.get(id=i), ids) - try: - stage = Chunk.tag_model.objects.get(slug=request.POST.get('stage')) + + stage = request.POST.get('stage') + if stage: + try: + stage = Chunk.tag_model.objects.get(slug=stage) + except Chunk.DoesNotExist, e: + stage = None + for c in chunks: c.stage = stage - except KeyError: pass - try: - user = User.objects.get(username=request.POST.get('user')) + username = request.POST.get('user') + logger.info("username: %s" % username) + logger.info(request.POST) + if username: + try: + user = User.objects.get(username=username) + except User.DoesNotExist, e: + user = None + for c in chunks: c.user = user - except KeyError: pass for c in chunks: c.save() + + return HttpResponse("", content_type="text/plain") else: raise Http404 diff --git a/apps/wiki/templates/wiki/tabs/gallery_view.html b/apps/wiki/templates/wiki/tabs/gallery_view.html index 22f98c92..c62a3b51 100644 --- a/apps/wiki/templates/wiki/tabs/gallery_view.html +++ b/apps/wiki/templates/wiki/tabs/gallery_view.html @@ -4,7 +4,7 @@