More signals? Ticket #2861

0 views
Skip to first unread message

Marek Kubica

unread,
Jul 23, 2007, 4:13:11 PM7/23/07
to django-d...@googlegroups.com
Hi!

Today I ran into a problem concerning ManyToManyFields. When I have a
model which has a ManyToManyField with a custom save() method and try to
access this ManyToManyField I get the old values of the M2M relation. This
is nothing special, as some kind folks on IRC told me. But I needed the
ManyToManyField values *after* they were updated. I tried with using the
post_save signal, but when this signal is emitted, the ManyToManyField
values have not yet updated.

So I think there are now two possibilities:
- Emit post_save after *all* fields have been saved, so that a method
which is connected to that signal will be able to access the data when
it is saved completely.
- Emit a new signal when the ManyToManyFields are up to date.

I find the current behaviour with a signal being sent while the data is
not up to data confusing, but I could live with the second alternative.
Something like this has already been proposed some time ago, in ticket
#2861 <http://code.djangoproject.com/ticket/2861>
and has an older discussion on django-developers:
<http://groups.google.com/group/django-developers/browse_thread/thread/a61ac8e02da4e2ea/0e91da3246a37758>

I'd be happy to see this solved or to know your ideas about how to deal
with situations like these.

regards,
Marek

Reply all
Reply to author
Forward
0 new messages