Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 6589992a38846dc3741f8aa934d5401c45bef98c 1 parent 4cb8cca
Adrian Holovaty adrianholovaty authored
4 django/contrib/admin/templatetags/admin_list.py
View
@@ -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.
4 django/db/models/options.py
View
@@ -10,7 +10,7 @@
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 @@ def __init__(self, fields=None, js=None, list_display=None, list_filter=None,
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
Please sign in to comment.
Something went wrong with that request. Please try again.