def populate_field(self, dictionary, key): if key is 'category': self.category = CategoryModel.get_by_id(long(dictionary[key])) elif key is 'prices': self.validate_prices_for( int(dictionary['places']), dictionary['prices']) self.prices = json.dumps(dictionary[key]) else: super(BookableModel, self).populate_field(dictionary, key) pass
def admin_move_bookable(entityId): bookable = BookableModel.get_by_id(entityId) jsd = request_helper.get_json_data() bookable.category = CategoryModel.get_by_id(long(jsd['category_id'])) bookable.put() return json.dumps(bookable.to_dict())
def populate_field(self, dictionary, key): if key is 'category': self.category = CategoryModel.get_by_id(long(dictionary[key])) else: super(ContentModel, self).populate_field(dictionary, key)
def admin_move_content(entityId): content = ContentModel.get_by_id(entityId) jsd = request_helper.get_json_data() content.category = CategoryModel.get_by_id(long(jsd['category_id'])) content.put() return json.dumps(content.to_dict())
def admin_delete_category(entityId): if request.method == "DELETE" or request.values["_method"] == "DELETE": CategoryModel.get_by_id(entityId).delete() return '{ "value" : "OK" }'