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
{{ message }}
Repository navigation
model config in inheritance doesn't respect MRO #9992
Hmm, I'm not convinced this should change - this would be a breaking change. When we merge fields, we respect the settings on the last field with the highest priority...
Ah yes, we've established this pattern in our docs:
When subclassing a model, the model_config attribute is inherited. This is helpful in the case where you'd like to use a base class with a given configuration for many models. Note, if you inherit from multiple BaseModel subclasses, like class MyModel(Model1, Model2), the non-default settings in the model_config attribute from the two models will be merged, and for any settings defined in both, those from Model2 will override those from Model1.
Activity
sydney-runkle commentedon Jul 30, 2024
Hmm, I'm not convinced this should change - this would be a breaking change. When we merge fields, we respect the settings on the last field with the highest priority...
sydney-runkle commentedon Jul 30, 2024
Ah yes, we've established this pattern in our docs:
KotlinIsland commentedon Jul 30, 2024
i find that very bizarre and unintuitive:
KotlinIsland commentedon Jul 31, 2024
@sydney-runkle was there any reasoning behind this pattern that you know of? what would it take to get it fixed?
sydney-runkle commentedon Jul 31, 2024
@KotlinIsland,
I agree with you, this is a concerning pattern. Perhaps we could address in V3. I'll open and tag it as such.
[-](🐞) model config merging doesn't respect mro[/-][+]model config in inheritance doesn't respect MRO[/+]