Use __get__ instead when autocreating to avoid overriding initial values
This commit is contained in:
parent
476df0ea3e
commit
4071ae7b86
1 changed files with 4 additions and 4 deletions
|
|
@ -32,12 +32,12 @@ class DBField(AttributeProperty):
|
||||||
self._key = f"{owner.slot or owner.name}::{name}"
|
self._key = f"{owner.slot or owner.name}::{name}"
|
||||||
owner.add_field(name, self)
|
owner.add_field(name, self)
|
||||||
|
|
||||||
def at_added(self, instance):
|
def at_added(self, component):
|
||||||
if self._autocreate:
|
if self._autocreate:
|
||||||
self.__set__(instance, self._default)
|
self.__get__(component, type(component))
|
||||||
|
|
||||||
def at_removed(self, instance):
|
def at_removed(self, component):
|
||||||
self.__delete__(instance)
|
self.__delete__(component)
|
||||||
|
|
||||||
|
|
||||||
class NDBField(NAttributeProperty):
|
class NDBField(NAttributeProperty):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue