def stories_update(id): story = get_story(id) data = dict(request.json) data.pop("_id", None) data.pop("cards", None) story["updated_at"] = datetime.utcnow() stories.update({"_id": story["_id"]}, {"$set": data}) extract.delay(id) return jsonify(get_story(id))
def stories_update(id): story = get_story(id) data = dict(request.json) data.pop('_id', None) data.pop('cards', None) story['updated_at'] = datetime.utcnow() stories.update({'_id': story['_id']}, {'$set': data}) extract.delay(id) return jsonify(get_story(id))
def stories_create(): story = dict(request.json) story.pop("_id", None) story["cards"] = [] story["created_at"] = datetime.utcnow() story["updated_at"] = datetime.utcnow() ret = stories.insert(story) extract.delay(unicode(ret)) return stories_get(ret)
def stories_create(): story = dict(request.json) story.pop('_id', None) story['cards'] = [] story['created_at'] = datetime.utcnow() story['updated_at'] = datetime.utcnow() ret = stories.insert(story) extract.delay(unicode(ret)) return stories_get(ret)