Fixed #2463 -- Fixed temporarily broken many-to-many fields in admin interface due to [3507]. Thanks, Nesh
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3508 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
97e820ab3a
commit
ad39bb1620
|
@ -289,8 +289,11 @@ class Field(object):
|
||||||
if self.choices:
|
if self.choices:
|
||||||
return first_choice + list(self.choices)
|
return first_choice + list(self.choices)
|
||||||
rel_model = self.rel.to
|
rel_model = self.rel.to
|
||||||
return first_choice + [(getattr(x, self.rel.get_related_field().attname), str(x))
|
if hasattr(self.rel, 'get_related_field'):
|
||||||
for x in rel_model._default_manager.complex_filter(self.rel.limit_choices_to)]
|
lst = [(getattr(x, self.rel.get_related_field().attname), str(x)) for x in rel_model._default_manager.complex_filter(self.rel.limit_choices_to)]
|
||||||
|
else:
|
||||||
|
lst = [(x._get_pk_val(), str(x)) for x in rel_model._default_manager.complex_filter(self.rel.limit_choices_to)]
|
||||||
|
return first_choice + lst
|
||||||
|
|
||||||
def get_choices_default(self):
|
def get_choices_default(self):
|
||||||
if self.radio_admin:
|
if self.radio_admin:
|
||||||
|
|
Loading…
Reference in New Issue