def init_tables(): user_dao = UserDao(db.session) for item in app.config['USERS']: user = user_dao.retrieve(username=item['username']) if user is None: user_dao.create(username=item['username'], password=item['password'], email=item['email'], first_name=item['first_name'], last_name=item['last_name'], is_superuser=item['is_superuser'], is_admin=item['is_admin'], is_active=item['is_active'], is_visible=item['is_visible'])
def post(self): parser = reqparse.RequestParser() parser.add_argument('username', type=str, required=True, location='json') parser.add_argument('password', type=str, required=True, location='json') parser.add_argument('email', type=str, required=True, location='json') parser.add_argument('first_name', type=str, location='json') parser.add_argument('last_name', type=str, location='json') parser.add_argument('is_admin', type=bool, location='json') parser.add_argument('is_active', type=bool, location='json') args = parser.parse_args() user_dao = UserDao(self.db_session()) user = user_dao.create(**args) return self.response(user.to_dict(), http.CREATED_201)