Exemplo n.º 1
0
 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
Exemplo n.º 2
0
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())
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
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())
Exemplo n.º 5
0
def admin_delete_category(entityId):
    if request.method == "DELETE" or request.values["_method"] == "DELETE":
        CategoryModel.get_by_id(entityId).delete()
        return '{ "value" : "OK" }'