浏览代码

feat(dyn): only pass update to pdns backend if A or AAAA has changed

Peter Thomassen 8 年之前
父节点
当前提交
750a67bdc6
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      desecapi/models.py

+ 2 - 1
desecapi/models.py

@@ -97,7 +97,8 @@ class Domain(models.Model):
     def save(self, *args, **kwargs):
     def save(self, *args, **kwargs):
         if self.id is None:
         if self.id is None:
             self.pdnsCreate()
             self.pdnsCreate()
-        if self.arecord or self.aaaarecord:
+        orig = Domain.objects.get(id=self.id)
+        if self.arecord != orig.arecord or self.aaaarecord != orig.aaaarecord:
             self.pdnsUpdate()
             self.pdnsUpdate()
         self.updated = timezone.now()
         self.updated = timezone.now()
         super(Domain, self).save(*args, **kwargs) # Call the "real" save() method.
         super(Domain, self).save(*args, **kwargs) # Call the "real" save() method.