You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When defining an ormar.Model and inheriting from both an abstract ormar.Model and a mixin (pydantic in my case), two problems arise:
Two database tables are generated (e.g. "nation" and "nations"), both with the mixin fields missing.
Describe the solution you'd like
Modifications to the inheritance design so that the resulting model is working and non-abstract.
Describe alternatives you've considered
Using abstract ormar.Model instead of pydantic BaseModel for the Create, Read and Update classes (if I understood everything correctly, I have to use ormar Fields anyway and the validation should still work). I don't know how much parsing/validation overhead I am adding with this though.
EDIT: just tried it and it does not work since an abstract ormar.Model can of course not be instantiated and thus not used for validation 🤦♂️
UPDATE: I must have made some kind of mistake; I can only recreate one of my findings on second try: the mixin fields don't appear in the final tables. I've updated the issue accordingly.
Is your feature request related to a problem? Please describe.
When defining an ormar.Model and inheriting from both an abstract ormar.Model and a mixin (pydantic in my case), two problems arise:
The resulting model is abstract by default, see Model inheriting from abstract models is abstract by default #876 (couldn't edit the issue sufficiently so I decided to reference it here)Two database tables are generated (e.g. "nation" and "nations"),both with the mixin fields missing.Describe the solution you'd like
Modifications to the inheritance design so that the resulting model is working and non-abstract.
Describe alternatives you've considered
Using abstract ormar.Model instead of pydantic BaseModel for the Create, Read and Update classes (if I understood everything correctly, I have to use ormar Fields anyway and the validation should still work). I don't know how much parsing/validation overhead I am adding with this though.
EDIT: just tried it and it does not work since an abstract ormar.Model can of course not be instantiated and thus not used for validation 🤦♂️
UPDATE: I must have made some kind of mistake; I can only recreate one of my findings on second try: the mixin fields don't appear in the final tables. I've updated the issue accordingly.