On Sep 20, 2011, at 4:23 PM, Stephan Jaensch wrote:
Am 20.09.2011 um 15:52 schrieb Roald de Vries:
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', 'downa...@gmail.com',
'password')
# these things I can't do:
m.users.add(u)
m.users.add(u, comment='Blablabla')
https://docs.djangoproject.com/en/1.3/topics/db/models/#intermediary-
manytomany
You can't use add() when specifying the intermediate model. You
would have to check all fields of the intermediate model and make
sure all of them have defaults or are allowed to be null. It might
not be worth the trouble of implementing it.
I don't see how this is different from the create method on the
intermediary model.
Cheers, Roald
PS: I found an open ticket on this, https://code.djangoproject.com/ticket/9475
--
You received this message because you are subscribed to the Google Groups "Django
developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.