Skip to content

Commit

Permalink
magic-removal: Fixed #1054 -- Changed admin changelist to use __str__…
Browse files Browse the repository at this point in the history
…(), not __repr__()

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2340 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Feb 18, 2006
1 parent 4cb8cca commit 6589992
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions django/contrib/admin/templatetags/admin_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions django/db/models/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6589992

Please sign in to comment.