Ejemplo n.º 1
0
def create():
    data = request.form
    new_trip_event = TripEvent.create(
        parent_trip=data['parent_trip'],
        event_name=data['event_name'],
        date_time=data['date_time'],
        location_address=data['location_address'],
        latitude=data['latitude'],
        longitude=data['longitude'],
        desc=data['desc'])

    result = jsonify({'status': True, 'data': new_trip_event.as_dict()})
    return result
Ejemplo n.º 2
0
    'parent_trip': Trip.select().first().id + 1,
    'date_time': datetime(2019, 4, 18),
    'location': 'California'
}, {
    'parent_trip': Trip.select().first().id + 2,
    'date_time': datetime(2019, 3, 22),
    'location': 'Arizona'
}, {
    'parent_trip': Trip.select().first().id + 3,
    'date_time': datetime(2019, 4, 2),
    'location': 'Florida'
}]

for te in tripevent_list:
    TripEvent.create(parent_trip=te['parent_trip'],
                     date_time=te['date_time'],
                     location=te['location'])

# File Attachments
from models.file_attachment import FileAttachment

file_list = [{
    'parent_event': TripEvent.select().first().id,
    'url': 'uploadplace.com/files/test_file1.file'
}, {
    'parent_event': TripEvent.select().first().id + 1,
    'url': 'uploadplace.com/files/test_file2.file'
}, {
    'parent_event': TripEvent.select().first().id + 1,
    'url': 'uploadplace.com/files/test_file.txt'
}, {