From 022a03ab32e85407109f2eda68b8725679c2f040 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Thu, 29 Sep 2005 23:16:29 +0000 Subject: [PATCH] Fixed #541 - generic views now may take a {{{template_loader}}} argument so they can use a different template loader than Django's own. Thanks, Joao. git-svn-id: http://code.djangoproject.com/svn/django/trunk@734 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/views/generic/create_update.py | 11 +++++++---- django/views/generic/date_based.py | 16 ++++++++++------ django/views/generic/list_detail.py | 6 ++++-- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/django/views/generic/create_update.py b/django/views/generic/create_update.py index d1775d61e9..f06e1d57e5 100644 --- a/django/views/generic/create_update.py +++ b/django/views/generic/create_update.py @@ -8,7 +8,8 @@ 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, - extra_context={}, post_save_redirect=None, login_required=False): + template_loader=template_loader, extra_context={}, + post_save_redirect=None, login_required=False): """ Generic object-creation function. @@ -65,8 +66,9 @@ 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, extra_lookup_kwargs={}, - extra_context={}, post_save_redirect=None, login_required=False): + slug_field=None, template_name=None, template_loader=template_loader, + extra_lookup_kwargs={}, extra_context={}, post_save_redirect=None, + login_required=False): """ Generic object-update function. @@ -139,7 +141,8 @@ 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, - extra_lookup_kwargs={}, extra_context={}, login_required=False): + template_loader=template_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 0e726f2a78..5dc9892894 100644 --- a/django/views/generic/date_based.py +++ b/django/views/generic/date_based.py @@ -7,7 +7,8 @@ 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, extra_lookup_kwargs={}, extra_context={}): + template_name=None, template_loader=template_loader, + extra_lookup_kwargs={}, extra_context={}): """ Generic top-level archive of date-based objects. @@ -49,7 +50,8 @@ 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, extra_lookup_kwargs={}, extra_context={}): + template_name=None, template_loader=template_loader, + extra_lookup_kwargs={}, extra_context={}): """ Generic yearly archive view. @@ -85,8 +87,8 @@ 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, extra_lookup_kwargs={}, - extra_context={}): + month_format='%b', template_name=None, template_loader=template_loader, + extra_lookup_kwargs={}, extra_context={}): """ Generic monthly archive view. @@ -138,7 +140,8 @@ 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, - extra_lookup_kwargs={}, extra_context={}, allow_empty=False): + template_loader=template_loader, extra_lookup_kwargs={}, + extra_context={}, allow_empty=False): """ Generic daily archive view. @@ -201,7 +204,8 @@ 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, - extra_lookup_kwargs={}, extra_context={}): + template_loader=template_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 373aef3e18..6328b7097a 100644 --- a/django/views/generic/list_detail.py +++ b/django/views/generic/list_detail.py @@ -7,7 +7,8 @@ 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, extra_lookup_kwargs={}, extra_context={}): + template_name=None, template_loader=template_loader, + extra_lookup_kwargs={}, extra_context={}): """ Generic list of objects. @@ -76,7 +77,8 @@ 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, - extra_lookup_kwargs={}, extra_context={}): + template_loader=template_loader, extra_lookup_kwargs={}, + extra_context={}): """ Generic list of objects.