Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #954 -- Many-to-many raw_id_admin change page now displays orig…

…inal object(s) correctly. Thanks for reporting, mordaha

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1489 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 2af63d3aab0b8f6fa18077aa62b931928864595b 1 parent 29d1598
@adrianholovaty adrianholovaty authored
Showing with 6 additions and 7 deletions.
  1. +6 −7 django/contrib/admin/views/main.py
View
13 django/contrib/admin/views/main.py
@@ -276,10 +276,9 @@ def get_javascript_imports(opts,auto_populated_fields, ordered_objects, field_se
break
return js
-
class AdminBoundField(BoundField):
def __init__(self, field, field_mapping, original):
- super(AdminBoundField, self).__init__(field,field_mapping,original)
+ super(AdminBoundField, self).__init__(field, field_mapping, original)
self.element_id = self.form_fields[0].get_id()
self.has_label_first = not isinstance(self.field, meta.BooleanField)
@@ -291,7 +290,7 @@ def __init__(self, field, field_mapping, original):
self.first = False
classes = []
- if(self.raw_id_admin):
+ if self.raw_id_admin:
classes.append('nowrap')
if max([bool(f.errors()) for f in self.form_fields]):
classes.append('error')
@@ -305,15 +304,15 @@ def _fetch_existing_display(self, func_name):
return func(self.original)
def _fill_existing_display(self):
- if self._display_filled:
+ if getattr(self, '_display_filled', False):
return
- #HACK
+ # HACK
if isinstance(self.field.rel, meta.ManyToOne):
func_name = 'get_%s' % self.field.name
self._display = self._fetch_existing_display(func_name)
elif isinstance(self.field.rel, meta.ManyToMany):
- func_name = 'get_%s_list' % self.field.name
- self._display = ",".join(self._fetch_existing_display(func_name))
+ func_name = 'get_%s_list' % self.field.rel.singular
+ self._display = ", ".join([str(obj) for obj in self._fetch_existing_display(func_name)])
self._display_filled = True
def existing_display(self):
Please sign in to comment.
Something went wrong with that request. Please try again.