Changeset 9046


Ignore:
Timestamp:
Apr 14, 2011, 7:14:31 PM (14 years ago)
Author:
rick
Message:

Get rid of the warnings, migrate to class based views:

http://docs.djangoproject.com/en/1.3/topics/generic-views-migration/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/samples/persisted/home/urls.py

    r9006 r9046  
    11from django.conf.urls.defaults import *
    22from django.views.generic.simple import direct_to_template
     3from django.views.generic.base import TemplateView
    34from django.conf import settings
    45
    56urlpatterns = patterns('',
    6     ('^about/$', direct_to_template, {
    7         'template': 'about.html'
    8     })
     7    ('^about/$', TemplateView.as_view(template_name='about.html'))
    98)
     9
     10class 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
    1015
    1116
    1217urlpatterns = 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'))
    2419)
Note: See TracChangeset for help on using the changeset viewer.