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
This commit is contained in:
Adrian Holovaty 2005-12-16 04:54:18 +00:00
parent 0c6653cf03
commit 5cbbd364c3
3 changed files with 14 additions and 13 deletions

View File

@ -1,6 +1,7 @@
from django import models from django import models
from django.core.xheaders import populate_xheaders 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.views.auth.login import redirect_to_login
from django.core.extensions import DjangoContext as Context from django.core.extensions import DjangoContext as Context
from django.core.paginator import ObjectPaginator, InvalidPage 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 from django.core.exceptions import Http404, ObjectDoesNotExist, ImproperlyConfigured
def create_object(request, app_label, module_name, template_name=None, 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): post_save_redirect=None, login_required=False, follow=None):
""" """
Generic object-creation function. Generic object-creation function.
@ -70,7 +71,7 @@ def create_object(request, app_label, module_name, template_name=None,
return HttpResponse(t.render(c)) return HttpResponse(t.render(c))
def update_object(request, app_label, module_name, object_id=None, slug=None, 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, extra_lookup_kwargs={}, extra_context={}, post_save_redirect=None,
login_required=False, follow=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, def delete_object(request, app_label, module_name, post_delete_redirect,
object_id=None, slug=None, slug_field=None, template_name=None, 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): extra_context={}, login_required=False):
""" """
Generic object-delete function. Generic object-delete function.

View File

@ -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.exceptions import Http404, ObjectDoesNotExist
from django.core.extensions import DjangoContext as Context from django.core.extensions import DjangoContext as Context
from django.core.xheaders import populate_xheaders from django.core.xheaders import populate_xheaders
@ -7,7 +7,7 @@ from django.utils.httpwrappers import HttpResponse
import datetime, time import datetime, time
def archive_index(request, app_label, module_name, date_field, num_latest=15, 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): extra_lookup_kwargs={}, extra_context={}, allow_empty=False):
""" """
Generic top-level archive of date-based objects. 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)) return HttpResponse(t.render(c))
def archive_year(request, year, app_label, module_name, date_field, 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={}): extra_lookup_kwargs={}, extra_context={}):
""" """
Generic yearly archive view. Generic yearly archive view.
@ -87,7 +87,7 @@ def archive_year(request, year, app_label, module_name, date_field,
return HttpResponse(t.render(c)) return HttpResponse(t.render(c))
def archive_month(request, year, month, app_label, module_name, date_field, 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={}): extra_lookup_kwargs={}, extra_context={}):
""" """
Generic monthly archive view. 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, def archive_day(request, year, month, day, app_label, module_name, date_field,
month_format='%b', day_format='%d', template_name=None, 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): extra_context={}, allow_empty=False):
""" """
Generic daily archive view. 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, def object_detail(request, year, month, day, app_label, module_name, date_field,
month_format='%b', day_format='%d', object_id=None, slug=None, month_format='%b', day_format='%d', object_id=None, slug=None,
slug_field=None, template_name=None, template_name_field=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={}): extra_context={}):
""" """
Generic detail view from year/month/day/slug or year/month/day/id structure. Generic detail view from year/month/day/slug or year/month/day/id structure.

View File

@ -1,5 +1,5 @@
from django import models from django import models
from django.core import template_loader from django.core.template import loader
from django.utils.httpwrappers import HttpResponse from django.utils.httpwrappers import HttpResponse
from django.core.xheaders import populate_xheaders from django.core.xheaders import populate_xheaders
from django.core.extensions import DjangoContext as Context 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 from django.core.exceptions import Http404, ObjectDoesNotExist
def object_list(request, app_label, module_name, paginate_by=None, allow_empty=False, 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={}): extra_lookup_kwargs={}, extra_context={}):
""" """
Generic list of objects. 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, def object_detail(request, app_label, module_name, object_id=None, slug=None,
slug_field=None, template_name=None, template_name_field=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={}): extra_context={}):
""" """
Generic list of objects. Generic list of objects.