Open Hultner opened 4 years ago
Hey, this is a duplicate of https://github.com/tiangolo/full-stack-fastapi-postgresql/issues/166 maybe which also has a PR already https://github.com/tiangolo/full-stack-fastapi-postgresql/pull/168
I think you should join the conversation over there.
After looking around there seems to be multiple PR's and issues about this.
Hey, one more Thing:
if update_data.get("password", default=False):
It doesn't work so for me in frontend app because of this error: TypeError: get() takes no keyword arguments.
if update_data.get("password", False):
works perfect.
If you try to update a user via the admin interface without changing the users password you will get a 500 error and a key-error in the logs, this is due to accessing the missing property directly while checking.
Error originates here: https://github.com/tiangolo/full-stack-fastapi-postgresql/blob/490c554e23343eec0736b06e59b2108fdd057fdc/%7B%7Bcookiecutter.project_slug%7D%7D/backend/app/app/crud/crud_user.py#L34
In my own copy I've solved this by changing it to:
This has the additional benefit of being more explicit about the missing case by using dict.get with a explicit default value.