Fixed #685 -- archive_index() and object_list() generic views allow empty

result sets by default now. Thanks, Gary Wilson and Matt Croydon.

This is a backwards incompatible change.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6833 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-12-02 15:43:35 +00:00
parent 81832f594d
commit 9075ac4b76
3 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ from django.http import Http404, HttpResponse
def archive_index(request, queryset, date_field, num_latest=15, def archive_index(request, queryset, date_field, num_latest=15,
template_name=None, template_loader=loader, template_name=None, template_loader=loader,
extra_context=None, allow_empty=False, context_processors=None, extra_context=None, allow_empty=True, context_processors=None,
mimetype=None, allow_future=False, template_object_name='latest'): mimetype=None, allow_future=False, template_object_name='latest'):
""" """
Generic top-level archive of date-based objects. Generic top-level archive of date-based objects.

View File

@ -5,7 +5,7 @@ from django.core.paginator import ObjectPaginator, InvalidPage
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
def object_list(request, queryset, paginate_by=None, page=None, def object_list(request, queryset, paginate_by=None, page=None,
allow_empty=False, template_name=None, template_loader=loader, allow_empty=True, template_name=None, template_loader=loader,
extra_context=None, context_processors=None, template_object_name='object', extra_context=None, context_processors=None, template_object_name='object',
mimetype=None): mimetype=None):
""" """

View File

@ -188,7 +188,7 @@ a date in the *future* are not included unless you set ``allow_future`` to
* ``allow_empty``: A boolean specifying whether to display the page if no * ``allow_empty``: A boolean specifying whether to display the page if no
objects are available. If this is ``False`` and no objects are available, objects are available. If this is ``False`` and no objects are available,
the view will raise a 404 instead of displaying an empty page. By the view will raise a 404 instead of displaying an empty page. By
default, this is ``False``. default, this is ``True``.
* ``context_processors``: A list of template-context processors to apply to * ``context_processors``: A list of template-context processors to apply to
the view's template. See the `RequestContext docs`_. the view's template. See the `RequestContext docs`_.
@ -718,7 +718,7 @@ A page representing a list of objects.
* ``allow_empty``: A boolean specifying whether to display the page if no * ``allow_empty``: A boolean specifying whether to display the page if no
objects are available. If this is ``False`` and no objects are available, objects are available. If this is ``False`` and no objects are available,
the view will raise a 404 instead of displaying an empty page. By the view will raise a 404 instead of displaying an empty page. By
default, this is ``False``. default, this is ``True``.
* ``context_processors``: A list of template-context processors to apply to * ``context_processors``: A list of template-context processors to apply to
the view's template. See the `RequestContext docs`_. the view's template. See the `RequestContext docs`_.