def post(self, current_user): title = request.json['title'] body = request.json['body'] default_image_url = os.environ['DEFAULT_IMAGE'] image_url = request.json.get('image_url', default_image_url) news = News(creator_key=current_user.key, title=title, body=body, image_url=image_url) news_key = news.put() return created(NewsIdJson(news_key))
def get(self): cursor = request.args.get('cursor') result, cursor, _ = News.all(cursor) return ok(ListNewsJson(result, cursor))