Browse Source

fix(dyn): fix regression due to 750a67bdc6e17227038d145036a1cfe6434cce1f

Peter Thomassen 8 years ago
parent
commit
356792cde3
1 changed files with 6 additions and 3 deletions
  1. 6 3
      desecapi/models.py

+ 6 - 3
desecapi/models.py

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