Code

Ticket #685: allow_empty=True.diff

File allow_empty=True.diff, 4.8 KB (added by Gary Wilson <gary.wilson@…>, 7 years ago)

default value of allow_empty changed to True for the generic views (archive_* except archive_week which already defaulted to True and object_list) with the documentation changes as well.

Line 
1=== modified file 'django/views/generic/date_based.py'
2--- django/views/generic/date_based.py  2006-12-19 04:35:09 +0000
3+++ django/views/generic/date_based.py  2007-01-15 03:09:40 +0000
4@@ -7,7 +7,7 @@
5 
6 def archive_index(request, queryset, date_field, num_latest=15,
7         template_name=None, template_loader=loader,
8-        extra_context=None, allow_empty=False, context_processors=None,
9+        extra_context=None, allow_empty=True, context_processors=None,
10         mimetype=None, allow_future=False):
11     """
12     Generic top-level archive of date-based objects.
13@@ -47,7 +47,7 @@
14     return HttpResponse(t.render(c), mimetype=mimetype)
15 
16 def archive_year(request, year, queryset, date_field, template_name=None,
17-        template_loader=loader, extra_context=None, allow_empty=False,
18+        template_loader=loader, extra_context=None, allow_empty=True,
19         context_processors=None, template_object_name='object', mimetype=None,
20         make_object_list=False, allow_future=False):
21     """
22@@ -96,7 +96,7 @@
23 
24 def archive_month(request, year, month, queryset, date_field,
25         month_format='%b', template_name=None, template_loader=loader,
26-        extra_context=None, allow_empty=False, context_processors=None,
27+        extra_context=None, allow_empty=True, context_processors=None,
28         template_object_name='object', mimetype=None, allow_future=False):
29     """
30     Generic monthly archive view.
31@@ -210,7 +210,7 @@
32 
33 def archive_day(request, year, month, day, queryset, date_field,
34         month_format='%b', day_format='%d', template_name=None,
35-        template_loader=loader, extra_context=None, allow_empty=False,
36+        template_loader=loader, extra_context=None, allow_empty=True,
37         context_processors=None, template_object_name='object',
38         mimetype=None, allow_future=False):
39     """
40
41=== modified file 'django/views/generic/list_detail.py'
42--- django/views/generic/list_detail.py 2006-12-19 04:35:09 +0000
43+++ django/views/generic/list_detail.py 2007-01-15 03:10:26 +0000
44@@ -5,7 +5,7 @@
45 from django.core.exceptions import ObjectDoesNotExist
46 
47 def object_list(request, queryset, paginate_by=None, page=None,
48-        allow_empty=False, template_name=None, template_loader=loader,
49+        allow_empty=True, template_name=None, template_loader=loader,
50         extra_context=None, context_processors=None, template_object_name='object',
51         mimetype=None):
52     """
53
54=== modified file 'docs/generic_views.txt'
55--- docs/generic_views.txt      2006-12-19 04:35:09 +0000
56+++ docs/generic_views.txt      2007-01-15 03:06:05 +0000
57@@ -186,7 +186,7 @@
58     * ``allow_empty``: A boolean specifying whether to display the page if no
59       objects are available. If this is ``False`` and no objects are available,
60       the view will raise a 404 instead of displaying an empty page. By
61-      default, this is ``False``.
62+      default, this is ``True``.
63 
64     * ``context_processors``: A list of template-context processors to apply to
65       the view's template. See the `RequestContext docs`_.
66@@ -260,7 +260,7 @@
67     * ``allow_empty``: A boolean specifying whether to display the page if no
68       objects are available. If this is ``False`` and no objects are available,
69       the view will raise a 404 instead of displaying an empty page. By
70-      default, this is ``False``.
71+      default, this is ``True``.
72 
73     * ``context_processors``: A list of template-context processors to apply to
74       the view's template. See the `RequestContext docs`_.
75@@ -354,7 +354,7 @@
76     * ``allow_empty``: A boolean specifying whether to display the page if no
77       objects are available. If this is ``False`` and no objects are available,
78       the view will raise a 404 instead of displaying an empty page. By
79-      default, this is ``False``.
80+      default, this is ``True``.
81 
82     * ``context_processors``: A list of template-context processors to apply to
83       the view's template. See the `RequestContext docs`_.
84@@ -520,7 +520,7 @@
85     * ``allow_empty``: A boolean specifying whether to display the page if no
86       objects are available. If this is ``False`` and no objects are available,
87       the view will raise a 404 instead of displaying an empty page. By
88-      default, this is ``False``.
89+      default, this is ``True``.
90 
91     * ``context_processors``: A list of template-context processors to apply to
92       the view's template. See the `RequestContext docs`_.
93@@ -704,7 +704,7 @@
94     * ``allow_empty``: A boolean specifying whether to display the page if no
95       objects are available. If this is ``False`` and no objects are available,
96       the view will raise a 404 instead of displaying an empty page. By
97-      default, this is ``False``.
98+      default, this is ``True``.
99 
100     * ``context_processors``: A list of template-context processors to apply to
101       the view's template. See the `RequestContext docs`_.
102