From 82b77b8b517e4f4d23efa8b4755985b13e563ed8 Mon Sep 17 00:00:00 2001 From: Hidden Z Date: Sat, 6 Nov 2010 16:06:23 +0000 Subject: [PATCH] pyi2phosts/urls.py: use callable to get external sources Needed for prevent queryset caching. http://docs.djangoproject.com/en/1.2/topics/generic-views/#adding-extra-context --- pyi2phosts/urls.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyi2phosts/urls.py b/pyi2phosts/urls.py index 7ee574b..ecdca97 100644 --- a/pyi2phosts/urls.py +++ b/pyi2phosts/urls.py @@ -9,6 +9,9 @@ from pyi2phosts.lib.utils import get_b32 from pyi2phosts.extsources.models import ExternalSource import settings +def get_extsources(): + return ExternalSource.objects.filter(active=True) + urlpatterns = patterns('', url(r'^$', direct_to_template, { 'template': 'index.html', @@ -23,7 +26,7 @@ urlpatterns = patterns('', 'template': 'faq.html', 'extra_context': { 'title': settings.SITE_NAME, - 'sources': ExternalSource.objects.filter(active=True) + 'sources': get_extsources } }, name='faq'), (r'^postkey/', include('pyi2phosts.postkey.urls')),