Re: Run some code after Model Save completes (and after database is updated)

2014-10-15 Thread Jani Tiainen
On Tue, 14 Oct 2014 10:00:17 -0700 (PDT)
Spiros Mouzakitis  wrote:

> Hi,
> 
> -I am looking for an elegant, and universal way to add some code AFTER the 
> saving of a model and after of course the database is updated with changes.
> -I have tried post_save signals, but the transaction is still on, the 
> entries do not exist in database
> -I have tried overriding save in models.py, but even if i put  the code 
> after.super(MyModel, self).save(*args, **kwargs), the database is still 
> not updated until the save function completes.

Database is definitely updated after save has completed and post_save signal is 
fired.

One thing that may interfere at least MySQL uses "repeatable read" (default) 
transcation isolation level
meaning that select will return db state when transaction opened. Changing 
isolation to "read committed" 
should improve situation there.

-- 

Jani Tiainen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20141016073835.14578089%40jns42-l.w2k.keypro.fi.
For more options, visit https://groups.google.com/d/optout.


Run some code after Model Save completes (and after database is updated)

2014-10-14 Thread Spiros Mouzakitis
Hi,

-I am looking for an elegant, and universal way to add some code AFTER the 
saving of a model and after of course the database is updated with changes.
-I have tried post_save signals, but the transaction is still on, the 
entries do not exist in database
-I have tried overriding save in models.py, but even if i put  the code 
after.super(MyModel, self).save(*args, **kwargs), the database is still 
not updated until the save function completes.

any ideas?

many thanks,
Spiros

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/763df2b0-5517-4296-9628-ba13132938e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.