From cfc1eb85823b39e0f767909ccd3a9709a5fd0ec2 Mon Sep 17 00:00:00 2001 From: Marcin Koziej Date: Thu, 10 May 2012 14:12:44 +0200 Subject: [PATCH] menu for mas editing stage and user --- .../templates/catalogue/book_list/book.html | 2 +- .../catalogue/book_list/book_list.html | 7 +- apps/catalogue/views.py | 27 ++- .../templates/wiki/tabs/gallery_view.html | 2 +- redakcja/settings/__init__.py | 2 + redakcja/static/js/catalogue/book_list.js | 75 ++++++--- redakcja/static/js/lib/jquery-1.4.2.min.js | 154 ------------------ redakcja/static/js/lib/jquery-1.7.2.min.js | 4 + 8 files changed, 81 insertions(+), 192 deletions(-) delete mode 100644 redakcja/static/js/lib/jquery-1.4.2.min.js create mode 100644 redakcja/static/js/lib/jquery-1.7.2.min.js 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 @@