def on_added(through_model_instance):
through_model_instance.balance = 1000.0 #although this one could be a default value at db level.
through_model_instance.save()
through_model_instance.achievements.create(tag='joined-this-relation')
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/ec5ffdfc-ef4b-4c30-a53d-d427cbe053e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Seems like it would be fine if Django allowed add() and let any errors about missing data bubble-up.
I personally think passing in a defaults dict (just like get_or_create does) would also be fine, but a callback seems like overkill.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAFO84S73z%2BXW4xj9YKmHNXu4KQ%2Be%3DEKqFfXJeK5JyCSXGANGfQ%40mail.gmail.com.
Seems interesting.
Also, added to the case where the only fields are the ones with only the two FK, there is the case where every other field has a default value (or at least accepts None). A call to .add, has no reason to fail in such cases.
For the other cases, a quick way to allow this, without depending on complex behaviours, would be to have allow something like :
publications = models.ManyToManyField(Publication, through=OtherModel, auto_create=True)Of course, auto_create is probably not the name we'd use, it would have to be thought about a bit more.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
It does seem like a somewhat arbitrary historical restriction. Collin's PoC change is surprisingly small and simple.Seems like it would be fine if Django allowed add() and let any errors about missing data bubble-up.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAJxq849m632K%3DaMfXGBtF%3DhMXFS9ujzU6xfUzNxSRkkN_UrkqQ%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/a32cf6ae-324a-40c1-b9d9-31bd43af2c2c%40googlegroups.com.