Code

Ticket #15287: patch.diff

File patch.diff, 4.3 KB (added by szczav, 3 years ago)
Line 
1Index: django/views/generic/date_based.py
2===================================================================
3--- django/views/generic/date_based.py  (wersja 15499)
4+++ django/views/generic/date_based.py  (kopia robocza)
5@@ -34,7 +34,7 @@
6         queryset = queryset.filter(**{'%s__lte' % date_field: datetime.datetime.now()})
7     date_list = queryset.dates(date_field, 'year')[::-1]
8     if not date_list and not allow_empty:
9-        raise Http404("No %s available" % model._meta.verbose_name)
10+        raise Http404("No %s available" % model._meta.object_name)
11 
12     if date_list and num_latest:
13         latest = queryset.order_by('-'+date_field)[:num_latest]
14@@ -354,7 +354,7 @@
15     try:
16         obj = queryset.get(**lookup_kwargs)
17     except ObjectDoesNotExist:
18-        raise Http404("No %s found for" % model._meta.verbose_name)
19+        raise Http404("No %s found for" % model._meta.object_name)
20     if not template_name:
21         template_name = "%s/%s_detail.html" % (model._meta.app_label, model._meta.object_name.lower())
22     if template_name_field:
23Index: django/views/generic/list_detail.py
24===================================================================
25--- django/views/generic/list_detail.py (wersja 15499)
26+++ django/views/generic/list_detail.py (kopia robocza)
27@@ -131,7 +131,7 @@
28     try:
29         obj = queryset.get()
30     except ObjectDoesNotExist:
31-        raise Http404("No %s found matching the query" % (model._meta.verbose_name))
32+        raise Http404("No %s found matching the query" % (model._meta.object_name))
33     if not template_name:
34         template_name = "%s/%s_detail.html" % (model._meta.app_label, model._meta.object_name.lower())
35     if template_name_field:
36Index: django/views/generic/dates.py
37===================================================================
38--- django/views/generic/dates.py       (wersja 15499)
39+++ django/views/generic/dates.py       (kopia robocza)
40@@ -194,7 +194,7 @@
41             qs = qs.filter(**{'%s__lte' % date_field: datetime.datetime.now()})
42 
43         if not allow_empty and not qs:
44-            raise Http404(u"No %s available" % unicode(qs.model._meta.verbose_name_plural))
45+            raise Http404(u"No %s list available" % unicode(qs.model._meta.object_name))
46 
47         return qs
48 
49@@ -208,7 +208,7 @@
50 
51         date_list = queryset.dates(date_field, date_type)[::-1]
52         if date_list is not None and not date_list and not allow_empty:
53-            raise Http404(u"No %s available" % unicode(qs.model._meta.verbose_name_plural))
54+            raise Http404(u"No %s list available" % unicode(qs.model._meta.object_name))
55 
56         return date_list
57 
58@@ -458,8 +458,8 @@
59         qs = self.get_queryset()
60 
61         if not self.get_allow_future() and date > datetime.date.today():
62-            raise Http404("Future %s not available because %s.allow_future is False." % (
63-                qs.model._meta.verbose_name_plural, self.__class__.__name__)
64+            raise Http404("Future %s list is not available because %s.allow_future is False." % (
65+                qs.model._meta.object_name, self.__class__.__name__)
66             )
67 
68         # Filter down a queryset from self.queryset using the date from the
69Index: django/views/generic/detail.py
70===================================================================
71--- django/views/generic/detail.py      (wersja 15499)
72+++ django/views/generic/detail.py      (kopia robocza)
73@@ -48,7 +48,7 @@
74             obj = queryset.get()
75         except ObjectDoesNotExist:
76             raise Http404(u"No %s found matching the query" %
77-                          (queryset.model._meta.verbose_name))
78+                          (queryset.model._meta.object_name))
79         return obj
80 
81     def get_queryset(self):
82Index: django/views/generic/create_update.py
83===================================================================
84--- django/views/generic/create_update.py       (wersja 15499)
85+++ django/views/generic/create_update.py       (kopia robocza)
86@@ -95,7 +95,7 @@
87         return model.objects.get(**lookup_kwargs)
88     except ObjectDoesNotExist:
89         raise Http404("No %s found for %s"
90-                      % (model._meta.verbose_name, lookup_kwargs))
91+                      % (model._meta.object_name, lookup_kwargs))
92 
93 def create_object(request, model=None, template_name=None,
94         template_loader=loader, extra_context=None, post_save_redirect=None,