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.
What does this PR do?
This PR adds functionality for auto-populating the
username
filed on theProfile
model when auser
signs up.Description of Task to be completed?
How should this be manually tested?
It can be tested on
Postman
as below:Terminal
Update the
.env
file as follows:Continue in Terminal
POST {your-server-root}:8000/api/users/register
request with a payload similar to:to register a
User
and generate an auth token3. Activate the account by clicking on the
link sent in the activation
email.4. With the auth token generated, send a
GET {your-server-root}:8000/api/users/profiles
request to view the auto-generated profile for the user just now created.[See screenshot for sample response]
tests
usingpytest
with the commandpytest
[orpytest -v
for verbose output].Any background context you want to provide?
Previously, on user account creation, the
first_name
field on theProfile
was populated with theusername
of the registered user. This PR changes that, because there is functionality which depends on querying theprofiles
table byusername
.What are the relevant pivotal tracker stories?
#162575779
Screenshots (if appropriate)
View on GET /api/users/profiles with logged in user
Questions:
Checklist: