You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
so, if you are still looking for solution, then you have to comment out @pre_load decorator in
profile's serializer.py. this will give you and error, that is solved by adding author=None as an argument to article view function make_article. this makes adding articles possible, user is set.
you can remove the @pre_load decorator from user/serializer.py, this will show you an error 422. i'm still struggling with it.
serializers for user and profile assume that every time frontend sends {'user': #payload } or {'profile': #payload }, but update and create article send only dict with payload keyvals.
so solution is to check if the user and profile key is in data, in functions decorated with pre_load (do something like this: return data.get('profile', data))
still, add that author=None to make_article.
for updating, you also need to allow for password to be empty in UserSchema.
( password = fields.Str(load_only=True, allow_none=True) )
I think it need new schema for updating user profile.
rajgoesout
added a commit
to rajgoesout/CI_CD_server_flask
that referenced
this issue
Apr 2, 2020
I am running the app in dev model. I tried to add a new article for a new user and got
KeyError: 'profile'
which was due to a problem of this code:Also, I got another key error when trying to update user profile:
The text was updated successfully, but these errors were encountered: