Ejemplo n.º 1
0
    def put(self):
        data = request.get_json()
        idm = data["id"]
        date = data["date"]
        name = data["name"]
        telephone = data["telephone"]
        email = data["email"]
        categorie = data["categorie"]
        toelichting = data["toelichting"]
        XCoordinaat = data["XCoordinaat"]
        XCoordinaat = data["YCoordinaat"]

        item = ItemModel.find_by_name(idm)
        updated_item = ItemModel(idm, date, name, telephone, email, categorie,
                                 toelichting, XCoordinaat, XCoordinaat)

        if item is None:
            item = ItemModel(idm, date, name, telephone, email, categorie,
                             toelichting, XCoordinaat, XCoordinaat)
        else:
            item.Score = Score
            item.latitude = cordinates[0]
            item.longitude = cordinates[1]
        item.save_to_db()

        return updated_item.json()
Ejemplo n.º 2
0
    def put(self, name):
        #data = Item.parser.parse_args()
        data = request.get_json()

        cordinates = data["features"][0]['geometry']['coordinates']
        Score = data["features"][0]['properties']['Score']
        #data = request.get_json()
        item =ItemModel.find_by_name(name)        
        updated_item = ItemModel(name, Score,cordinates[0],cordinates[1])

        if item is None:
            item =ItemModel(name, Score,cordinates[0],cordinates[1])
        else:
            item.Score = Score
            item.latitude = cordinates[0]
            item.longitude = cordinates[1]
        item.save_to_db()

        return updated_item.json()