[extensions-web/django/upgrade-1.8] django: moved away from deprecated function-based generic views.
- From: Yuri Konotopov <ykonotopov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web/django/upgrade-1.8] django: moved away from deprecated function-based generic views.
- Date: Sun, 23 Oct 2016 08:58:58 +0000 (UTC)
commit bf6ec8f575d8f3d5844fca97d749fa1dc0ea5bdd
Author: Yuri Konotopov <ykonotopov gnome org>
Date: Sun Oct 23 11:55:43 2016 +0300
django: moved away from deprecated function-based generic views.
sweettooth/auth/urls.py | 5 ++---
sweettooth/extensions/urls.py | 8 ++++----
sweettooth/review/urls.py | 8 ++++----
3 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/sweettooth/auth/urls.py b/sweettooth/auth/urls.py
index 321026c..3906475 100644
--- a/sweettooth/auth/urls.py
+++ b/sweettooth/auth/urls.py
@@ -1,5 +1,5 @@
-from django.views.generic.simple import direct_to_template
+from django.views.generic.base import TemplateView
from django.conf.urls import patterns, url, include
from django.contrib.auth.views import login, logout
from auth import views, forms
@@ -19,8 +19,7 @@ urlpatterns = patterns('',
dict(form_class=forms.AutoFocusRegistrationForm),
name='registration_register'),
- url(r'settings/(?P<user>.+)', direct_to_template,
- dict(template='registration/settings.html'),
+ url(r'settings/(?P<user>.+)', TemplateView.as_view(template_name='registration/settings.html'),
name='auth-settings'),
url(r'', include('registration.urls')),
diff --git a/sweettooth/extensions/urls.py b/sweettooth/extensions/urls.py
index ef4d043..355c034 100644
--- a/sweettooth/extensions/urls.py
+++ b/sweettooth/extensions/urls.py
@@ -1,6 +1,6 @@
from django.conf.urls import patterns, include, url
-from django.views.generic.simple import direct_to_template
+from django.views.generic.base import TemplateView
from extensions import views, models, feeds
@@ -29,16 +29,16 @@ shell_patterns = patterns('',
)
urlpatterns = patterns('',
- url(r'^$', direct_to_template, dict(template='extensions/list.html'), name='extensions-index'),
+ url(r'^$', TemplateView.as_view(template_name='extensions/list.html'), name='extensions-index'),
- url(r'^about/$', direct_to_template, dict(template='extensions/about.html'), name='extensions-about'),
+ url(r'^about/$', TemplateView.as_view(template_name='extensions/about.html'), name='extensions-about'),
url(r'^extension/(?P<pk>\d+)/(?P<slug>.+)/$',
views.extension_view, name='extensions-detail'),
url(r'^extension/(?P<pk>\d+)/$',
views.extension_view, dict(slug=None), name='extensions-detail'),
- url(r'^local/', direct_to_template, dict(template='extensions/local.html'), name='extensions-local'),
+ url(r'^local/', TemplateView.as_view(template_name='extensions/local.html'), name='extensions-local'),
url(r'^rss/', feeds.LatestExtensionsFeed(), name='extensions-rss-feed'),
diff --git a/sweettooth/review/urls.py b/sweettooth/review/urls.py
index 5d35a79..6cab221 100644
--- a/sweettooth/review/urls.py
+++ b/sweettooth/review/urls.py
@@ -1,14 +1,14 @@
from django.conf.urls import patterns, url
-from django.views.generic.list_detail import object_list
+from django.views.generic.list import ListView
from extensions.models import ExtensionVersion
from review import views
urlpatterns = patterns('',
- url(r'^$', object_list, dict(queryset=ExtensionVersion.objects.unreviewed(),
- template_object_name='version',
- template_name='review/list.html'),
+ url(r'^$', ListView.as_view(template_name='review/list.html',
+ queryset=ExtensionVersion.objects.unreviewed(),
+ context_object_name='version_list'),
name='review-list'),
url(r'^ajax/get-file/(?P<pk>\d+)', views.ajax_get_file_view, name='review-ajax-files'),
url(r'^ajax/get-file-list/(?P<pk>\d+)', views.ajax_get_file_list_view, name='review-ajax-file-list'),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]