As far as insert or update, just overide the save method within the
class.  It is something that must be done for each class, but what I
have done (for essentially the same purpose) is override save() on
each model I need to log the action for like so:

def save():
    # if id exists, this record has already been created
    if foo.id:
        # create the log entry for an update
    else:
        # create the log entry for an insert
    super(foo, self).save()

Do the same for delete()

To make it easier I have abstracted my save and delete methods, they
are defined as methods within my apps models.py and the individual
model classes call them, passing (self) and getting back a
'model_instance' object for user with the super.save()

-rfd

On Aug 21, 1:20 pm, "Lic. José M. Rodriguez Bacallao"
<[EMAIL PROTECTED]> wrote:
> how can I know programatically if an operation in a model is an insert,
> update or delete?
> I just want to extend the admin log to log any action in my application
> models. Right now,
> admin app only log actions executed by itself.
>
> --
> Lic. José M. Rodriguez Bacallao
> Cupet
> -----------------------------------------------------------------
> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
> mismo.
>
> Recuerda: El arca de Noe fue construida por aficionados, el titanic por
> profesionales
> -----------------------------------------------------------------


--~--~---------~--~----~------------~-------~--~----~
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