class FooForm(forms.ModelForm):


    class Meta:
        model = Foo
bars = forms.ModelMultipleChoiceField(queryset=Bar.objects.all())

def __init__(self, *args, **kwargs):
    super(FooForm, self).__init__(*args, **kwargs)
if self.instance:
    self.fields['bars'].initial = self.instance.bar_set.all()

def save(self, *args, **kwargs):
    instance = super(FooForm, self).save(commit=False)
self.fields['bars'].initial.update(foo=None)
self.cleaned_data['bars'].update(foo=instance)
return instance


class FooAdmin(admin.ModelAdmin):
    form = FooForm
one-to-many inline select with django admin