Ticket #15287: patch.diff

File patch.diff, 4.3 KB (added by szczav, 14 years ago)
  • django/views/generic/date_based.py

     
    3434        queryset = queryset.filter(**{'%s__lte' % date_field: datetime.datetime.now()})
    3535    date_list = queryset.dates(date_field, 'year')[::-1]
    3636    if not date_list and not allow_empty:
    37         raise Http404("No %s available" % model._meta.verbose_name)
     37        raise Http404("No %s available" % model._meta.object_name)
    3838
    3939    if date_list and num_latest:
    4040        latest = queryset.order_by('-'+date_field)[:num_latest]
     
    354354    try:
    355355        obj = queryset.get(**lookup_kwargs)
    356356    except ObjectDoesNotExist:
    357         raise Http404("No %s found for" % model._meta.verbose_name)
     357        raise Http404("No %s found for" % model._meta.object_name)
    358358    if not template_name:
    359359        template_name = "%s/%s_detail.html" % (model._meta.app_label, model._meta.object_name.lower())
    360360    if template_name_field:
  • django/views/generic/list_detail.py

     
    131131    try:
    132132        obj = queryset.get()
    133133    except ObjectDoesNotExist:
    134         raise Http404("No %s found matching the query" % (model._meta.verbose_name))
     134        raise Http404("No %s found matching the query" % (model._meta.object_name))
    135135    if not template_name:
    136136        template_name = "%s/%s_detail.html" % (model._meta.app_label, model._meta.object_name.lower())
    137137    if template_name_field:
  • django/views/generic/dates.py

     
    194194            qs = qs.filter(**{'%s__lte' % date_field: datetime.datetime.now()})
    195195
    196196        if not allow_empty and not qs:
    197             raise Http404(u"No %s available" % unicode(qs.model._meta.verbose_name_plural))
     197            raise Http404(u"No %s list available" % unicode(qs.model._meta.object_name))
    198198
    199199        return qs
    200200
     
    208208
    209209        date_list = queryset.dates(date_field, date_type)[::-1]
    210210        if date_list is not None and not date_list and not allow_empty:
    211             raise Http404(u"No %s available" % unicode(qs.model._meta.verbose_name_plural))
     211            raise Http404(u"No %s list available" % unicode(qs.model._meta.object_name))
    212212
    213213        return date_list
    214214
     
    458458        qs = self.get_queryset()
    459459
    460460        if not self.get_allow_future() and date > datetime.date.today():
    461             raise Http404("Future %s not available because %s.allow_future is False." % (
    462                 qs.model._meta.verbose_name_plural, self.__class__.__name__)
     461            raise Http404("Future %s list is not available because %s.allow_future is False." % (
     462                qs.model._meta.object_name, self.__class__.__name__)
    463463            )
    464464
    465465        # Filter down a queryset from self.queryset using the date from the
  • django/views/generic/detail.py

     
    4848            obj = queryset.get()
    4949        except ObjectDoesNotExist:
    5050            raise Http404(u"No %s found matching the query" %
    51                           (queryset.model._meta.verbose_name))
     51                          (queryset.model._meta.object_name))
    5252        return obj
    5353
    5454    def get_queryset(self):
  • django/views/generic/create_update.py

     
    9595        return model.objects.get(**lookup_kwargs)
    9696    except ObjectDoesNotExist:
    9797        raise Http404("No %s found for %s"
    98                       % (model._meta.verbose_name, lookup_kwargs))
     98                      % (model._meta.object_name, lookup_kwargs))
    9999
    100100def create_object(request, model=None, template_name=None,
    101101        template_loader=loader, extra_context=None, post_save_redirect=None,
Back to Top