Add 'locale' field to JustfixUser model. #1472
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This helps with #1384 by adding a
locale
field to theJustfixUser
model. This will help us when we need to initiate tasks on behalf of the user from a context where we can't retrieve their email from a request, e.g. sending them an email or text message from a worker process.The
locale
field is set when a user first onboards with us, and its value is taken from the request, so if the user onboards in Spanish,locale
will bees
.Note: Because Django doesn't actually set defaults at the database schema level, pushing this change to production might require us to temporarily disable Heroku Preboot, since old dynos creating new users post-migration won't know about the
locale
column and Postgres will demand that they set it.To do
locale
to the locale of the request.