From 5cbbd364c3db2b72b8b0698d5321ce23a435c1d2 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 16 Dec 2005 04:54:18 +0000 Subject: [PATCH] Fixed #1041 -- Generic views no longer use deprecated template_loader. Thanks for the patch, Ian git-svn-id: http://code.djangoproject.com/svn/django/trunk@1684 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/views/generic/create_update.py | 9 +++++---- django/views/generic/date_based.py | 12 ++++++------ django/views/generic/list_detail.py | 6 +++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/django/views/generic/create_update.py b/django/views/generic/create_update.py index 87f78c5930..da15bd1a43 100644 --- a/django/views/generic/create_update.py +++ b/django/views/generic/create_update.py @@ -1,6 +1,7 @@ from django import models from django.core.xheaders import populate_xheaders -from django.core import template_loader, formfields, meta +from django.core.template import loader +from django.core import formfields, meta from django.views.auth.login import redirect_to_login from django.core.extensions import DjangoContext as Context from django.core.paginator import ObjectPaginator, InvalidPage @@ -8,7 +9,7 @@ from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect from django.core.exceptions import Http404, ObjectDoesNotExist, ImproperlyConfigured def create_object(request, app_label, module_name, template_name=None, - template_loader=template_loader, extra_context={}, + template_loader=loader, extra_context={}, post_save_redirect=None, login_required=False, follow=None): """ Generic object-creation function. @@ -70,7 +71,7 @@ def create_object(request, app_label, module_name, template_name=None, return HttpResponse(t.render(c)) def update_object(request, app_label, module_name, object_id=None, slug=None, - slug_field=None, template_name=None, template_loader=template_loader, + slug_field=None, template_name=None, template_loader=loader, extra_lookup_kwargs={}, extra_context={}, post_save_redirect=None, login_required=False, follow=None): """ @@ -145,7 +146,7 @@ def update_object(request, app_label, module_name, object_id=None, slug=None, def delete_object(request, app_label, module_name, post_delete_redirect, object_id=None, slug=None, slug_field=None, template_name=None, - template_loader=template_loader, extra_lookup_kwargs={}, + template_loader=loader, extra_lookup_kwargs={}, extra_context={}, login_required=False): """ Generic object-delete function. diff --git a/django/views/generic/date_based.py b/django/views/generic/date_based.py index ca4b4b86e3..eb7386daf3 100644 --- a/django/views/generic/date_based.py +++ b/django/views/generic/date_based.py @@ -1,4 +1,4 @@ -from django.core import template_loader +from django.core.template import loader from django.core.exceptions import Http404, ObjectDoesNotExist from django.core.extensions import DjangoContext as Context from django.core.xheaders import populate_xheaders @@ -7,7 +7,7 @@ from django.utils.httpwrappers import HttpResponse import datetime, time def archive_index(request, app_label, module_name, date_field, num_latest=15, - template_name=None, template_loader=template_loader, + template_name=None, template_loader=loader, extra_lookup_kwargs={}, extra_context={}, allow_empty=False): """ Generic top-level archive of date-based objects. @@ -50,7 +50,7 @@ def archive_index(request, app_label, module_name, date_field, num_latest=15, return HttpResponse(t.render(c)) def archive_year(request, year, app_label, module_name, date_field, - template_name=None, template_loader=template_loader, + template_name=None, template_loader=loader, extra_lookup_kwargs={}, extra_context={}): """ Generic yearly archive view. @@ -87,7 +87,7 @@ def archive_year(request, year, app_label, module_name, date_field, return HttpResponse(t.render(c)) def archive_month(request, year, month, app_label, module_name, date_field, - month_format='%b', template_name=None, template_loader=template_loader, + month_format='%b', template_name=None, template_loader=loader, extra_lookup_kwargs={}, extra_context={}): """ Generic monthly archive view. @@ -136,7 +136,7 @@ def archive_month(request, year, month, app_label, module_name, date_field, def archive_day(request, year, month, day, app_label, module_name, date_field, month_format='%b', day_format='%d', template_name=None, - template_loader=template_loader, extra_lookup_kwargs={}, + template_loader=loader, extra_lookup_kwargs={}, extra_context={}, allow_empty=False): """ Generic daily archive view. @@ -200,7 +200,7 @@ def archive_today(request, **kwargs): def object_detail(request, year, month, day, app_label, module_name, date_field, month_format='%b', day_format='%d', object_id=None, slug=None, slug_field=None, template_name=None, template_name_field=None, - template_loader=template_loader, extra_lookup_kwargs={}, + template_loader=loader, extra_lookup_kwargs={}, extra_context={}): """ Generic detail view from year/month/day/slug or year/month/day/id structure. diff --git a/django/views/generic/list_detail.py b/django/views/generic/list_detail.py index 18500b26de..c4c3e85945 100644 --- a/django/views/generic/list_detail.py +++ b/django/views/generic/list_detail.py @@ -1,5 +1,5 @@ from django import models -from django.core import template_loader +from django.core.template import loader from django.utils.httpwrappers import HttpResponse from django.core.xheaders import populate_xheaders from django.core.extensions import DjangoContext as Context @@ -7,7 +7,7 @@ from django.core.paginator import ObjectPaginator, InvalidPage from django.core.exceptions import Http404, ObjectDoesNotExist def object_list(request, app_label, module_name, paginate_by=None, allow_empty=False, - template_name=None, template_loader=template_loader, + template_name=None, template_loader=loader, extra_lookup_kwargs={}, extra_context={}): """ Generic list of objects. @@ -80,7 +80,7 @@ def object_list(request, app_label, module_name, paginate_by=None, allow_empty=F def object_detail(request, app_label, module_name, object_id=None, slug=None, slug_field=None, template_name=None, template_name_field=None, - template_loader=template_loader, extra_lookup_kwargs={}, + template_loader=loader, extra_lookup_kwargs={}, extra_context={}): """ Generic list of objects.