class EventViewSet(Resource): def __init__(self): self.requests = EventRequests() def get(self): return {'status':'success','data':self.requests.events()} def post(self): _owner = request.form['owner'] _organization = request.form['organization'] _address = request.form['address'] _name = request.form['name'] _body = request.form['body'] _time_begins = request.form['time_begins'] _time_ends = request.form['time_ends'] _amount_raised = request.form['amount_raised'] _latitude = request.form['latitude'] _longitude = request.form['longitude'] return {'status':'success', 'data': Event.create(owner=_owner, organization=_organization, address=_address, name=_name, body=_body, time_begins=_time_begins, time_ends=_time_ends, amount_raised=_amount_raised, latitude=_latitude, longitude=_longitude).dict() } def delete(self): return {'status':'success'}
print '----- User request tests -----' user_requests = UserRequests() user = user_requests.user_with_email('*****@*****.**') print user print print '----- Address request tests -----' address_requests = AddressRequests() address = address_requests.address_with_id(1) print address print print '----- Account request tests -----' account_requests = AccountRequests() account = account_requests.account_with_id(1) print account print print '----- Event request tests -----' event_requests = EventRequests() event = event_requests.event_with_id(1) print event print print '----- Transaction request tests -----' transaction_requests = TransactionRequests() transaction = transaction_requests.transaction_with_id(1) print transaction print
def __init__(self): self.requests = EventRequests()