Mercurial > public > sg101
diff bandmap/views.py @ 843:09ed84a7394c
For issue #76, store pre-rendered HTML for each band map entry.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 13 Oct 2014 16:48:43 -0500 |
parents | 7735f8a6bd1f |
children | bb7e2fc24690 |
line wrap: on
line diff
--- a/bandmap/views.py Sun Oct 12 14:59:43 2014 -0500 +++ b/bandmap/views.py Mon Oct 13 16:48:43 2014 -0500 @@ -7,7 +7,6 @@ from django.shortcuts import redirect, render from django.contrib import messages as django_messages from django.http import HttpResponse -from django.template.loader import render_to_string from django.core.cache import cache from django.conf import settings @@ -67,18 +66,16 @@ bands = [] for band in qs.iterator(): - note = render_to_string('bandmap/balloon.html', {'band': band}) - note = note.strip().replace('\n', '') bands.append({ 'name': band.name, 'lat': band.lat, 'lon': band.lon, 'is_active': band.is_active, - 'note': note, + 'note': band.html, }) results = json.dumps(bands) # Store in cache - cache.set(cache_key, results, 300) + cache.set(cache_key, results, 600) return HttpResponse(results, content_type='application/json')