Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django constance - on save method

Tags:

Is there any way to call django command after changing constance value? I need to call:

python manage.py installtasks

for my kronos cron jobs. I don't have any idea how can I set this. In constance docs I found:

from constance.signals import config_updated

@receiver(config_updated)
def constance_updated(sender, key, old_value, new_value, **kwargs):
    print(sender, key, old_value, new_value)

but I don't know what is receiver (I get "NameError: name 'receiver' is not defined") and where should I put this code. Any help?

like image 586
jundymek Avatar asked Jun 18 '17 12:06

jundymek


1 Answers

You could import the decorator,

from django.dispatch import receiver
like image 131
zaidfazil Avatar answered Sep 30 '22 00:09

zaidfazil