mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
new_admin: fixes a problem with init on ManyToMany fields with only one possible selection
git-svn-id: http://code.djangoproject.com/svn/django/branches/new-admin@1222 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
1d421ab9c4
commit
907feaacc7
@ -778,9 +778,10 @@ class ManyToManyField(Field):
|
||||
else:
|
||||
# In required many-to-many fields with only one available choice,
|
||||
# select that one available choice.
|
||||
if not self.blank and not self.rel.edit_inline and not self.rel.raw_id_admin and self.choices:
|
||||
choice_list = self.get_choices_default()
|
||||
if len(choice_list) == 1:
|
||||
if not self.blank and not self.rel.edit_inline and not self.rel.raw_id_admin:
|
||||
choices_list = self.get_choices_default()
|
||||
if len(choices_list) == 1:
|
||||
print self.name, choices_list[0][0]
|
||||
new_data[self.name] = [choices_list[0][0]]
|
||||
return new_data
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user