diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index a9ba6d5bea..894b73c6c7 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -76,8 +76,8 @@ def result_headers(cl): except models.FieldDoesNotExist: # For non-field list_display values, check for the function # attribute "short_description". If that doesn't exist, fall - # back to the method name. And __repr__ is a special-case. - if field_name == '__repr__': + # back to the method name. And __str__ is a special-case. + if field_name == '__str__': header = lookup_opts.verbose_name else: attr = getattr(cl.model, field_name) # Let AttributeErrors propogate. diff --git a/django/db/models/options.py b/django/db/models/options.py index c06ecabc1b..88051d99c8 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -10,7 +10,7 @@ import re get_verbose_name = lambda class_name: re.sub('([A-Z])', ' \\1', class_name).lower().strip() DEFAULT_NAMES = ('verbose_name', 'verbose_name_plural', 'db_table', 'ordering', - 'unique_together', 'permissions', 'get_latest_by', + 'unique_together', 'permissions', 'get_latest_by', 'order_with_respect_to', 'app_label') class Options: @@ -206,7 +206,7 @@ class AdminOptions: save_on_top=False, list_select_related=False): self.fields = fields self.js = js or [] - self.list_display = list_display or ['__repr__'] + self.list_display = list_display or ['__str__'] self.list_filter = list_filter or [] self.date_hierarchy = date_hierarchy self.save_as, self.ordering = save_as, ordering