mirror of https://github.com/django/django.git
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
This commit is contained in:
parent
bab70003fe
commit
022a03ab32
|
@ -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.
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue