Saturday 15 June 2013

mysql - Calling Python script from Django Admin UI (on field value change) -



mysql - Calling Python script from Django Admin UI (on field value change) -

i new django programming, , have limited knowledge of it's architecture.

i have python script (converted .exe) want run when field changed in database using django admin.

i have mysql database table boolean field. info in table accessed (modified) using djando admin ui. django admin ui displays boolean field checkbox in alter form. want trigger test.exe script when check-box selected (boolean value = 'true') , user clicks "save". additionally, want terminate/ kill script when user unselects checkbox (boolean field value = false) , clicks "save".

thanks in advance.

maybe django's signals system can help you.

it allows run operations before or after model has been saved.

example of pre-save action django's doc (1.7):

from django.db.models.signals import pre_save django.dispatch import receiver myapp.models import mymodel @receiver(pre_save, sender=mymodel) def my_handler(sender, **kwargs): # want here note:

as long signal's code executed, no response given client. asynchronous work suggest celery.

python mysql django external

No comments:

Post a Comment