blob: fa558175b8658aa01af64a09b9912f454560c410 [file] [log] [blame]
Sapan Bhatia0235e982014-09-03 13:14:40 -04001from django.db.models.signals import post_save
2from django.dispatch import receiver
3import pdb
Sapan Bhatiafe9bc892014-09-15 03:48:11 -04004from core.models import *
5import model_policies
Sapan Bhatia0235e982014-09-03 13:14:40 -04006
7@receiver(post_save)
8def post_save_handler(sender, **kwargs):
9 sender_name = sender.__name__
10 policy_name = 'model_policy_%s'%sender_name
11 try:
Sapan Bhatiafe9bc892014-09-15 03:48:11 -040012 policy_handler = getattr(model_policies, policy_name)
13 policy_handler.handle(sender)
Sapan Bhatia0235e982014-09-03 13:14:40 -040014 except:
15 pass