mirror of
https://github.com/django/django.git
synced 2025-04-19 06:44:36 +00:00
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
This commit is contained in:
parent
4cb8cca158
commit
6589992a38
@ -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.
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user