We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1f74bdd commit 424d314Copy full SHA for 424d314
ninja/orm/metaclass.py
@@ -92,11 +92,13 @@ def __new__(
92
meta_conf = meta_conf.model_dump(exclude_none=True)
93
94
fields = factory.convert_django_fields(**meta_conf)
95
+ namespace.setdefault("__annotations__", {})
96
for field, val in fields.items():
- # set type
97
- namespace.setdefault("__annotations__", {})[field] = val[0]
98
- # and default value
99
- namespace[field] = val[1]
+ if not namespace["__annotations__"].get(field, None):
+ # set type
+ namespace["__annotations__"][field] = val[0]
100
+ # and default value
101
+ namespace[field] = val[1]
102
103
cls = super().__new__(
104
mcs,
0 commit comments