]> git.ipfire.org Git - thirdparty/python-drafthorse.git/commitdiff
Fix missing setter
authorRaphael Michel <mail@raphaelmichel.de>
Thu, 25 Oct 2018 19:26:58 +0000 (21:26 +0200)
committerRaphael Michel <mail@raphaelmichel.de>
Thu, 25 Oct 2018 19:26:58 +0000 (21:26 +0200)
drafthorse/models/fields.py

index 5b10b3897ece0fc41fb0f989fc45d1ac7951e9e2..1065b3bd3d301ca7c326b7fa8f5d68cce4167843 100644 (file)
@@ -114,6 +114,11 @@ class DecimalField(Field):
         self.namespace = namespace
         self.tag = tag
 
+    def __set__(self, instance, value):
+        if instance._data.get(self.name, None) is None:
+            instance._data[self.name] = self.initialize()
+        instance._data[self.name].value = value
+
     def initialize(self):
         return self.cls(self.namespace, self.tag)