I have simple class with default_model like this:
class User(BaseModel):
class Meta:
collection = db.client.users
default_model = {
'cooldowns': {
'bonus': 0,
'transfer': 0,
}
}
how do I copy Meta.default_model without linking it to the class itself? That is, that the dictate would be one-time, and not inherited from the class itself. I've tried two attempts, but they are all tied to the class anyway(
#first try
model = {"user_id": 1}
for k, v in cls.Meta.default_model.items():
if k not in model:
model[k] = v
#second try
model = {"user_id": 1} | cls.Meta.default_model.copy()
What i mean:
class User:
class Meta:
default_model = {
"cooldowns": {
"bonous": 0
}
}
model = {}
for k, v in User.Meta.default_model.items():
model[k] = v
# It changes User.Meta.default_model
model['cooldowns']['bonous'] = 1
print(User.Meta.default_model)