Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from models import UserModel
- class UserRegistration(Resource):
- def post(self):
- data = parser.parse_args()
- new_user = UserModel(
- username = data['username'],
- password = data['password']
- )
- try:
- new_user.save_to_db()
- return {
- 'message': 'User {} was created'.format( data['username'])
- }
- except:
- return {'message': 'Something went wrong'}, 500
Add Comment
Please, Sign In to add comment