Use __get__ instead when autocreating to avoid overriding initial values

This commit is contained in:
ChrisLR 2024-01-02 11:21:04 -05:00
parent 476df0ea3e
commit 4071ae7b86

View file

@ -32,12 +32,12 @@ class DBField(AttributeProperty):
self._key = f"{owner.slot or owner.name}::{name}"
owner.add_field(name, self)
def at_added(self, instance):
def at_added(self, component):
if self._autocreate:
self.__set__(instance, self._default)
self.__get__(component, type(component))
def at_removed(self, instance):
self.__delete__(instance)
def at_removed(self, component):
self.__delete__(component)
class NDBField(NAttributeProperty):