def post(self, user_id): args = profileParser.parse_args() username = args['username'] school = args['school'] intro = args['intro'] lolID = args['lolID'] dotaID = args['dotaID'] hstoneID = args['hstoneID'] gender = args['gender'] profile = Profile.objects(user=user_id).first() if profile is None: profile = Profile(user=user_id) profile.username = username profile.school = school profile.intro = intro profile.lolID = lolID profile.dotaID = dotaID profile.hstoneID = hstoneID profile.gender = gender profile.save() rongRefresh(profile.id) return serialize(profile)
def post(self, user_id): """ Edit the user's profile if the profile exists Otherwise, create a new profile document """ args = profileParser.parse_args() username = args['username'] school = args['school'] intro = args['intro'] profile = Profile.objects(user=user_id).first() if profile is None: profile = Profile( user=user_id, username=username, school=school, intro=intro) profile.save() else: profile.username = username profile.school = school profile.intro = intro profile.save() return serialize(profile)
def post(self, user_id): """ Edit the user's profile if the profile exists Otherwise, create a new profile document """ args = profileParser.parse_args() username = args['username'] school = args['school'] intro = args['intro'] profile = Profile.objects(user=user_id).first() if profile is None: profile = Profile(user=user_id, username=username, school=school, intro=intro) profile.save() else: profile.username = username profile.school = school profile.intro = intro profile.save() return serialize(profile)