Skip to content
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

Add default_values configuration #113

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

whatcould
Copy link

This provides a way to set defaults on each model — without adding an extra column to the CSV.

Some potential uses could be batch number, imported_by, etc etc.

@whatcould
Copy link
Author

Note that these are added before the find_model step, so you can use these defaults as part of the identifiers to look up existing records.

@pcreux
Copy link
Owner

pcreux commented Sep 16, 2024

Hey @whatcould ! Thank you for your PR.

I was about to say you could use after_build to set defaults, but it doesn't allow you to use these defaults as part of the identifiers to look up existing records. since it's called after find_or_build.

What about updating the flow to call after_build in build_model instead of after find_or_build.

That way, we wouldn't introduce a new way to set default values, and I believe that it would also improve the current behavior: calling after_build on existing models can seem counterintuitive.

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants