Permalink
Browse files

Remove deprecated direct_to_template

  • Loading branch information...
1 parent cc7d1d7 commit ce167cc8655a1e74aa5207436d1791753e5a31b5 @yourcelf committed Jun 13, 2012
Showing with 27 additions and 19 deletions.
  1. +19 −10 scanblog/about/urls.py
  2. +4 −4 scanblog/accounts/urls.py
  3. +4 −5 scanblog/accounts/views.py
View
@@ -1,14 +1,23 @@
from django.conf.urls.defaults import *
-from django.views.generic.simple import direct_to_template
+from django.views.generic.base import TemplateView
urlpatterns = patterns('',
- url(r'^$', direct_to_template, {"template": "about/index.html"}, name="about"),
- url(r'^copyright/$', direct_to_template, {"template": "about/copyright.html"}, name="about.copyright"),
- url(r'^faq/$', direct_to_template, {"template": "about/faq.html"}, name="about.faq"),
- url(r'^resources/$', direct_to_template, {"template": "about/resources.html"}, name="about.resources"),
- url(r'^guidelines/$', direct_to_template, {"template": "about/guidelines.html"}, name="about.community_guidelines"),
- url(r'^terms/$', direct_to_template, {"template": "about/terms.html"}, name="about.terms"),
- url(r'^privacy/$', direct_to_template, {"template": "about/privacy.html"}, name="about.privacy"),
- url(r'^dmca/$', direct_to_template, {"template": "about/dmca.html"}, name="about.dmca"),
- url(r'^join/$', direct_to_template, {"template": "about/get_involved.html"}, name="about.get_involved"),
+ url(r'^$', TemplateView.as_view(template_name="about/index.html"),
+ name="about"),
+ url(r'^copyright/$', TemplateView.as_view(template_name="about/copyright.html"),
+ name="about.copyright"),
+ url(r'^faq/$', TemplateView.as_view(template_name="about/faq.html"),
+ name="about.faq"),
+ url(r'^resources/$', TemplateView.as_view(template_name="about/resources.html"),
+ name="about.resources"),
+ url(r'^guidelines/$', TemplateView.as_view(template_name="about/guidelines.html"),
+ name="about.community_guidelines"),
+ url(r'^terms/$', TemplateView.as_view(template_name="about/terms.html"),
+ name="about.terms"),
+ url(r'^privacy/$', TemplateView.as_view(template_name="about/privacy.html"),
+ name="about.privacy"),
+ url(r'^dmca/$', TemplateView.as_view(template_name="about/dmca.html"),
+ name="about.dmca"),
+ url(r'^join/$', TemplateView.as_view(template_name="about/get_involved.html"),
+ name="about.get_involved"),
)
@@ -1,5 +1,5 @@
from django.conf.urls.defaults import *
-from django.views.generic.simple import direct_to_template
+from django.views.generic.base import TemplateView
from registration.views import register
from accounts.forms import OptionalEmailForm
@@ -15,8 +15,8 @@
'backend': 'accounts.backends.SimpleRegistrationBackend',
'form_class': OptionalEmailForm,
}, name='registration_register'),
- url(r'^register/closed/$', direct_to_template, {
- 'template': 'registration/registration_closed.html'
- }, name='registration_disallowed'),
+ url(r'^register/closed/$',
+ TemplateView.as_view(template_name='registration/registration_closed.html'),
+ name='registration_disallowed'),
(r'', include('registration.auth_urls')),
)
@@ -10,11 +10,10 @@
from django.contrib.auth.models import User
from django.contrib.auth.forms import SetPasswordForm, PasswordChangeForm
from django.contrib import messages
-from django.shortcuts import render_to_response
+from django.shortcuts import render
from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib.auth.decorators import login_required
-from django.views.generic.simple import direct_to_template
from btb.utils import can_edit_user
from accounts.forms import OptionalEmailForm
@@ -67,12 +66,12 @@ def change_password(request, user_id):
else:
form = Form(request.user)
- return render_to_response("registration/password_change_form.html",{
+ return render(request, "registration/password_change_form.html", {
'form': form,
'change_user': user,
- }, context_instance=RequestContext(request))
+ })
@login_required
def welcome(request):
- return direct_to_template(request, template='registration/welcome.html')
+ return render(request, 'registration/welcome.html')

0 comments on commit ce167cc

Please sign in to comment.