From 20d28bf78904f7c0665f6dc7b3835e80215d9e4f Mon Sep 17 00:00:00 2001 From: Rafael Ferreira Date: Fri, 22 Nov 2013 20:12:32 -0200 Subject: [PATCH] adjusted views --- deliveryservice.py | 2 ++ models.py | 1 + urls.py | 1 + views.py | 4 ++-- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/deliveryservice.py b/deliveryservice.py index 25b3373..741cc3d 100644 --- a/deliveryservice.py +++ b/deliveryservice.py @@ -50,6 +50,7 @@ class GetUpdateUserRequest(messages.Message): avg_price = messages.StringField(2) vehicle = messages.StringField(3) social_id = messages.StringField(4) + photo = messages.StringField(5) class DeliveryService(remote.Service): @remote.method(GetDeliveriesRequest, Deliveries) @@ -128,6 +129,7 @@ def update_user(self, request): app_user.last_status = 'Aguardando' app_user.avg_price = request.avg_price app_user.social_id = request.social_id + app_user.photo = request.photo app_user.put() diff --git a/models.py b/models.py index 71a30d7..c2cd959 100644 --- a/models.py +++ b/models.py @@ -14,6 +14,7 @@ class AppUser(db.Model): social_id = db.StringProperty() name = db.StringProperty() phone = db.StringProperty() + photo = db.StringProperty() class DeliverFee(db.Model): source_address = db.StringProperty() diff --git a/urls.py b/urls.py index 3a5f4cd..ff585f3 100644 --- a/urls.py +++ b/urls.py @@ -28,6 +28,7 @@ (r'^app/listDeliveries$', 'views.listDeliveries'), (r'^app/listOffers', 'views.listOffers'), (r'^app/confirmOffer', 'views.confirmOffer'), + (r'^app/deliverCoordinates', 'views.deliverCoordinates'), #(r'^admin/cameras$', 'views.listCam'), #(r'^admin/camera/editar/(\d+)$', 'views.editCamera'), #(r'^admin/camera/editar$', 'views.editCamera'), diff --git a/views.py b/views.py index 01e1bac..4a80767 100644 --- a/views.py +++ b/views.py @@ -202,10 +202,10 @@ def deliverCoordinates(request): deliver_id) #ok, here we need to find the DeliveryOffer that is currently in progress, after the confirmation - q = db.GqlQuery("SELECT * FROM DeliverOffer WHERE deliver_fee = :1 AND state = 'Aceito' ") + q = db.GqlQuery("SELECT * FROM DeliverOffer WHERE deliver_fee = :1 AND state = 'Aceito' ", deliver) offer = q.get() - return HttpResponse("{ }", content_type="application/jason") + return HttpResponse("{ 'src_lat' : %s, 'src_lgn': %s, 'des_lat' : %s, 'des_lgn' : %s, 'drv_lat' : %s, 'drv_lgn' : %s }" % ( deliver.source_lat, deliver.source_lng, deliver.dest_lat, deliver.dest_lng, offer.app_user.last_lat, offer.app_user.last_lng ), content_type="application/json") def create_offer_query(deliver): return db.GqlQuery("SELECT * "