2011/9/20 Łukasz Rekucki <[email protected]>: > On 20 September 2011 15:52, Roald de Vries <[email protected]> wrote: >> Hi all, >> >> Is there a fundamental reason that I'm missing (other than "nobody's taken >> the trouble of writing it") that I can't do the following? If there isn't >> I'll create a ticket for it. >> >> class R(Model): >> user = ForeignKey(User) >> my_model = ForeignKey('MyModel') >> comment = CharField(max_length=100, blank=True) >> >> class MyModel(Model): >> users = ManyToManyField(User, through=R, null=True) >> >> m = MyModel.objects.create() >> u = User.objects.create_user('roald', '[email protected]', 'password') >> >> >> # these things I can't do: >> m.users.add(u) >> m.users.add(u, comment='Blablabla') >> >> Cheers, Roald >> > > I'm 100% sure there's *at least one* ticket for this. You just need to > search for it and you'll probably find the discussion of this too.
There certainly is "at least one" ticket :-) There's the original ticket that introduced m2m intermediate models: https://code.djangoproject.com/ticket/6095 And there's this one: https://code.djangoproject.com/ticket/9475 which asks for this feature specifically. Back when the feature was added (#6095), we discussed add() with intermediate models that have extra data. If you read the full ticket history for #6095, and #9475, you can see the edge cases that existed at the time. Ultimately, we punted on the issue in the interest of delivering *something*. I'm certainly interested in the idea, as long as the edge cases can be managed and/or explained. Yours Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
