On Wed, 2009-01-21 at 07:05 -0800, Evgeniy Ivanov (powerfox) wrote: > Hi, > > I've returned to the problem and noticed, that recipe described in the > docs is a kind of wrong: intermediary model is just a kind of M2M (I > mean multiselection) since you have select widgets for inline model > and to make real m2m editing have to add more inlines. > > Custom model can help, but this hack is ugly too: > > ========================================================================================================== > class Groups(ModelForm): > users = forms.ModelMultipleChoiceField(queryset=Users.objects.all > (),required=False) > > widget=admin.widgets.FilteredSelectMultiple(_("Users"), False)) > class Meta: > model = Groups > ========================================================================================================== > > Now you have to add custom saving! It's wrong IMHO.
How is it wrong that when you want a custom form you have to actually write some code? Django cannot read your mind. It cannot possibly accommodate every single use-case of every person on the planet out of the box. It's designed to be extensible for precisely that reason. "I have to write some code" is not a bad thing. Django is a library for programmers. > I think it would be much better to specify both M2M fields with the > same table name. Well, have lots of fun implementing your own field type to do this, if it's what you want. Django's ManyToManyField is, and always will be, specified on exactly on model. That describes the data and the programmatic API. Trying to hack that to modify the presentation of a form is still attacking the wrong end of the problem. Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---