You can have a pre_save signal for adding property
instance._is_new=True if the instance has no id. And then to delete
that property in the post_save signal after checking it.

Regards,
Aidas Bendoraitis [aka Archatas]



On 4/4/07, David Larlet <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'd like to know if it's possible to make the difference between
> addition and change for the post_save signal. For the moment I use
> something like that:
>
> def log_modification(sender, instance, signal):
>     try:
>         print sender.objects.get(id=instance.id)
>         LogEntry.objects.log_action(..., CHANGE)
>     except sender.DoesNotExist:
>         LogEntry.objects.log_action(..., ADDITION)
>
> It works but it had to be call by the pre_save signal and I need to be
> sure it's saved before logging it. Any thoughts?
>
> Thanks,
> David
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to