From 6589992a38846dc3741f8aa934d5401c45bef98c Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sat, 18 Feb 2006 20:29:12 +0000 Subject: [PATCH] magic-removal: Fixed #1054 -- Changed admin changelist to use __str__(), not __repr__() git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2340 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admin/templatetags/admin_list.py | 4 ++-- django/db/models/options.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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