Ahh, great! No problem.

Karl Sutt


On Sun, May 13, 2012 at 3:26 PM, Alireza Savand <alireza.sav...@gmail.com>wrote:

> Aha i solved it
>
> sender.objects.get(id=kwargs['instance'].id)
> be
> sender.objects.get(*pk*=kwargs['instance'].*pk*)
>
> Thank you again Karl ;)
>
>
> On Sunday, May 13, 2012 5:39:34 PM UTC+4, Alireza Savand 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/-/KQUNwR9k25sJ.
>
> 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.

Reply via email to