-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Use defaults values from BaseModel in ModelFactory #466
Comments
@ShtykovaAA yeah this is definitely possible. The default values are parsed and stored when parsing the model already so this shouldn't be a difficult addition. Just to clarify, when setting |
@guacs correct! |
@adhtruong am I right in thinking we don't have to worry about the defaults when it comes to the |
@guacs SQLAlchemy has a couple forms on default
In both cases, omitting the parameter itself should trigger using the default. Case 1 could be handled the same as above implementation but 2 is a bit more complex as may rely on a db (e.g. primary key with sequence). |
Summary
I think it would be great if
ModelFactory
can use defaults values fromBaseModel
Basic Example
For example I have class
AppSettings
, where I setapp_title
as APP_TITLE by defaultAnd now I can specify
app_title
asAPP_TITLE
inModelFactory
if only I set it modelSo I think it would be great to have an extra param for using defaults in
ModelFactory
. Maybe something like thisDrawbacks and Impact
No response
Unresolved questions
No response
Note
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.
Check out all issues funded or available for funding on our Polar.sh dashboard
The text was updated successfully, but these errors were encountered: