Changeset 9046
- Timestamp:
- Apr 14, 2011, 7:14:31 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/samples/persisted/home/urls.py
r9006 r9046 1 1 from django.conf.urls.defaults import * 2 2 from django.views.generic.simple import direct_to_template 3 from django.views.generic.base import TemplateView 3 4 from django.conf import settings 4 5 5 6 urlpatterns = patterns('', 6 ('^about/$', direct_to_template, { 7 'template': 'about.html' 8 }) 7 ('^about/$', TemplateView.as_view(template_name='about.html')) 9 8 ) 9 10 class GoogleTemplateView(TemplateView): 11 def get_context_data(self, **kwargs): 12 context = super(GoogleTemplateView, self).get_context_data(**kwargs) 13 context.update({ 'google_key': settings.GOOGLE_MAPS_KEY }) 14 return context 10 15 11 16 12 17 urlpatterns = patterns('home.views', 13 url( 14 regex = r'', 15 view = direct_to_template, 16 name = 'home', 17 kwargs = { 18 'template': 'home.html', 19 'extra_context': { 20 'google_key':settings.GOOGLE_MAPS_KEY, 21 } 22 } 23 ), 18 ('^$', GoogleTemplateView.as_view(template_name='home.html')) 24 19 )
Note:
See TracChangeset
for help on using the changeset viewer.