mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-01-22 20:44:55 +00:00
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
This commit is contained in:
parent
cff54ef2be
commit
82b77b8b51
@ -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…
x
Reference in New Issue
Block a user