On Jun 11, 1:11 pm, Russell Keith-Magee <
russ...@keith-magee.com>
wrote:
Thanks for the prompt reply! I skimmed through the ticket but I'm not
sure I spotted any particularly unsolvable problems. Just to clarify,
I am interested in the following three issues, more or less
independently from each other:
1) remove(): The only related comment I read in the ticket is "There
is an analogous problem with remove - since you can now have multiple
relations between objects, a simple remove method is no longer an
option.". But remove() is a method of a descriptor referring to a
specific m2m relation, so it is clear to which one it refers to. E.g.
in your example:
a_group.club_membership.remove(a_person) # remove person from
club_members
a_group.team_membership.remove(a_person) # remove person from
team_members.
If the issue had to do specifically with the fact that that the same
through model (Membership) was used between Group and Person more than
once, I am not interested in allowing this; the current validation
approach is fine.
2) add() for m2m-intermediates with only null/default/derived extra
fields. If I'm reading your comments correctly, you were against
adding null=True to fields that are not semantically nullable, just as
a workaround for add(). I agree and I'm not suggesting adding nulls or
defaults just for the sake of making add() work, but for fields that
should accept null or a default regardless, why prevent them ? As for
the implementation, I'm not suggesting any 'compile time' validation
and introspection; just let any errors happen when add() eventually
calls through.create(...).
3) add() for m2m-intermediates with required extra fields. The
suggestion in the ticket is to pass an 'extra' dict argument; I'm fine
with that instead of passing them as **extra; it has the added benefit
it can be used in create() as well (although I'm less interested in
allowing create). Fully agree with your comments about not adding more
fine-grained, per-object extra arguments (you can always use multiple
calls to add()) or an additional "add_extra" method.
If there are any other issues I ignored, let me know and I'll be happy
to consider them.
George