New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: How to use a reserved BaseModel attribute? #395
Comments
Good news! This was fixed yesterday in release I'll make that alpha release a proper release in a few days unless we find any problems. |
It’s indeed fixing the ValidationError. Thanks! |
Or allowing shadowing the way does Django with defaulting Model.objects to Model._default_manager? https://stackoverflow.com/questions/34427817/django-difference-between-base-manager-and-objects |
I see your point on renaming, perhaps we should have started out by naming all those methods However changing all those models now would break a lot of code, SemVar or not this would take me alone hours to fix across all the projects using pydantic. It would also upset mypy and IDEs when people access "private" properties. I think the best solution at this stage is aliases. |
I know 😔 |
Do you get warnings from IDE when you access, for example, |
In pycharm yes. |
Question
I’d like to migrate from
attr.s
to Pydantic, but I’ve got a couple of models that have the name schema as attribute. Ideally, I would like to not change other parts of the code base except from the model itself.Having a look at #243 it seems that the following names for model attributes are not allowed:
Would it be possible to consider renaming some of these methods with underscore, like
_schema
or__schema__
?Maybe something like what django-meta is doing.
I know it would be a breaking change, that’s what the
0.*
is for, right? 😬The text was updated successfully, but these errors were encountered: