From 385c9c22477064ad00ffbe8a079dbaea1e0c463c Mon Sep 17 00:00:00 2001 From: oyvinlek Date: Sun, 6 Mar 2011 21:53:58 +0000 Subject: [PATCH] Ryddet litt i koden til MapIndex. --- python/web/library/views.py | 12 ++++++++++-- python/web/templates/map/index.html | 6 +++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/python/web/library/views.py b/python/web/library/views.py index b1c1ae5..0887476 100644 --- a/python/web/library/views.py +++ b/python/web/library/views.py @@ -59,8 +59,16 @@ def PersonIndex(request): def MapIndex(request): shelves = Placement.get_all_shelves() - shelf_lists = [(shelf, Placement.shelf_as_list_row_then_col(shelf)) for shelf in shelves] - return render_to_response('map/index.html', {'shelf_lists': shelf_lists}) + highlight_list = [] + if 'highlight' in request.GET: + highlight_string = request.GET['highlight'] + for category in Category.objects.filter(id=highlight_string): + highlight_list.append(category) + shelf_lists = [{'shelf_name': shelf, + 'shelf_list': Placement.shelf_as_list_row_then_col(shelf)} + for shelf in shelves] + print highlight_list + return render_to_response('map/index.html', {'shelf_lists': shelf_lists, 'highlight': highlight_list}) def MapView(request,shelf_identifier): if shelf_identifier not in Placement.get_all_shelves(): diff --git a/python/web/templates/map/index.html b/python/web/templates/map/index.html index 4704288..bdc2fcd 100644 --- a/python/web/templates/map/index.html +++ b/python/web/templates/map/index.html @@ -9,14 +9,14 @@ Hyllekart {% for shelf in shelf_lists %} - - {% for row in shelf.1 %} + + {% for row in shelf.shelf_list %} {% for column in row %}
Hylle {% if forloop.last %}B{% else %}A{% endif %}Hylle {{ shelf.shelf_name }}
{% for category in column %} - + {% endfor %}
{{ category }}
{% if category in highlight_list %}!!{% endif %}{{ category }}