Include model policies
diff --git a/planetstack/core/models/plcorebase.py b/planetstack/core/models/plcorebase.py
index 446245b..4ac60b3 100644
--- a/planetstack/core/models/plcorebase.py
+++ b/planetstack/core/models/plcorebase.py
@@ -5,6 +5,7 @@
from django.forms.models import model_to_dict
from django.core.urlresolvers import reverse
from django.forms.models import model_to_dict
+import model_policies
try:
# This is a no-op if observer_disabled is set to 1 in the config file
diff --git a/planetstack/model_policies.py b/planetstack/model_policies.py
new file mode 100644
index 0000000..3663c27
--- /dev/null
+++ b/planetstack/model_policies.py
@@ -0,0 +1,8 @@
+from django.core.signals import post_save
+from django.dispatch import receiver
+import pdb
+
+@receiver(post_save)
+def post_save_handler(sender, **kwargs):
+ pdb.set_trace()
+ print("Request finished!")
diff --git a/planetstack/model_policies/model_policy_Site.py b/planetstack/model_policies/model_policy_Site.py
new file mode 100644
index 0000000..e1183b2
--- /dev/null
+++ b/planetstack/model_policies/model_policy_Site.py
@@ -0,0 +1,3 @@
+def handle(o):
+ print "In handler"
+
diff --git a/planetstack/model_policy.py b/planetstack/model_policy.py
new file mode 100644
index 0000000..38caf01
--- /dev/null
+++ b/planetstack/model_policy.py
@@ -0,0 +1,14 @@
+from django.db.models.signals import post_save
+from django.dispatch import receiver
+import pdb
+from model_policies import *
+
+@receiver(post_save)
+def post_save_handler(sender, **kwargs):
+ sender_name = sender.__name__
+ policy_name = 'model_policy_%s'%sender_name
+ try:
+ policy_handler = globals[policy_name]
+ policy_handler(sender)
+ except:
+ pass