I think you can just change the "id" in instance = sender.objects.get(id=kwargs['instance'].id)
to "iso" and that should to the trick. Try it, as I haven't verified it. And let us know. Good luck, Karl Sutt On Sun, May 13, 2012 at 2:39 PM, Alireza Savand <alireza.sav...@gmail.com>wrote: > Okay, i found a problem in it. > One of my models doesn't use *id* as a default *pk*. > is use different primary key, called *iso.* > So here the traceback > http://dpaste.de/o7kSw/ > It's not working with those model with different primary key :| > > > On Saturday, May 12, 2012 3:13:28 PM UTC+4, Karl Sutt wrote: >> >> Thanks. So, in onPreSave, you use kwargs['instance'], assuming it's the >> instance before saving (which it is, not just in the "current" state). So >> kwargs['instance'] in both handlers have the same state. If you want to get >> the current state (the old state, so to speak), you should to something like >> >> sender.objects.get(id=kwargs['**instance'].id) >> >> >> This would get you the current state of the that instance. >> >> Hope this is clear and helps. >> >> Karl Sutt >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/b7HViV6o7AoJ. > > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.