Ticket #16655: silent_error_in_list_display_callables1.diff

File silent_error_in_list_display_callables1.diff, 1.1 KB (added by jedie, 13 years ago)
  • django/contrib/admin/templatetags/admin_list.py

    diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
    index fdf082b..6db04a5 100644
    a b def items_for_result(cl, result, form):  
    135135        row_class = ''
    136136        try:
    137137            f, attr, value = lookup_field(field_name, result, cl.model_admin)
    138         except (AttributeError, ObjectDoesNotExist):
     138        except ObjectDoesNotExist:
    139139            result_repr = EMPTY_CHANGELIST_VALUE
    140140        else:
    141141            if f is None:
  • tests/regressiontests/admin_views/models.py

    diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py
    index b65f8a4..032ea1f 100644
    a b class ChapterXtra2(models.Model):  
    8080    def __unicode__(self):
    8181        return u'¿Xtra2: %s' % self.xtra
    8282
    83 def callable_year(dt_value):
    84     return dt_value.year
     83def callable_year(obj):
     84    return obj.model_year()
    8585callable_year.admin_order_field = 'date'
    8686
    8787class ArticleInline(admin.TabularInline):
Back to Top