Browse Source

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
pull/1/head
Hidden Z 14 years ago
parent
commit
82b77b8b51
  1. 5
      pyi2phosts/urls.py

5
pyi2phosts/urls.py

@ -9,6 +9,9 @@ from pyi2phosts.lib.utils import get_b32
from pyi2phosts.extsources.models import ExternalSource from pyi2phosts.extsources.models import ExternalSource
import settings import settings
def get_extsources():
return ExternalSource.objects.filter(active=True)
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^$', direct_to_template, { url(r'^$', direct_to_template, {
'template': 'index.html', 'template': 'index.html',
@ -23,7 +26,7 @@ urlpatterns = patterns('',
'template': 'faq.html', 'template': 'faq.html',
'extra_context': { 'extra_context': {
'title': settings.SITE_NAME, 'title': settings.SITE_NAME,
'sources': ExternalSource.objects.filter(active=True) 'sources': get_extsources
} }
}, name='faq'), }, name='faq'),
(r'^postkey/', include('pyi2phosts.postkey.urls')), (r'^postkey/', include('pyi2phosts.postkey.urls')),

Loading…
Cancel
Save