Where should signal handlers live in a django project? -


i have started implementing signal listeners in django project. while understand , how use them. having hard time figuring out should put them. documentation django site has say:

where should code live?

you can put signal handling , registration code anywhere like. however, you'll need make sure module it's in gets imported on signal handling gets registered before signals need sent. makes app's models.py place put registration of signal handlers.

while suggestion, having non model classes or methods in models.py rubs me wrong way.

so then, best practice/rule storing , registering signal handlers?

i make them classmethods of model itself. keeps within 1 class, , means don't have worry importing anything.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -