From 125f0234040476dafdc7e1554f9983fff60629fb Mon Sep 17 00:00:00 2001 From: "Jonathan S. Katz" Date: Sat, 17 Dec 2011 18:29:13 -0500 Subject: [PATCH] Stops sending M2M updates from PgModel objects upon every single update Prevents changes from M2M updates from appearing after every single save to a PgModel derived class. The unfortunate side effect is that no M2M updates will appear, but this has to do with the context in how the diff between two objects it taking place. An expanded note appears in the explanation to #110 Fixes #110 --- pgweb/util/bases.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pgweb/util/bases.py b/pgweb/util/bases.py index 73974896..c4573e7d 100644 --- a/pgweb/util/bases.py +++ b/pgweb/util/bases.py @@ -59,7 +59,6 @@ class PgModel(object): oldobj = self.__class__.objects.get(pk=self.pk) except self.DoesNotExist, e: return ('A new %s has been added' % self._meta.verbose_name, self.full_text_representation()) - if hasattr(self,'approved'): # This object has the capability to do approving. Apply the following logic: # 1. If object was unapproved, and is still unapproved, don't send notification @@ -139,7 +138,7 @@ class PgModel(object): oldobj._get_attr_value(n), n, self._get_attr_value(n), - ) for n in fieldlist if not getattr(oldobj,n)==getattr(self,n)]) + ) for n in fieldlist if oldobj._get_attr_value(n) != self._get_attr_value(n)]) if not s: return None return s -- 2.39.5