Ejemplo n.º 1
0
 def post(self):
     # TODO: sanity test
     group = self.request.get('group')
     vendor = self.request.get('vendor')
     event = Event(group = Group.get_by_id(long(group)),
                   vendor = Vendor.get_by_id(long(vendor)),
                   advocate = users.get_current_user())
     
     event.put()
     self.redirect('/u/mine/profile')
Ejemplo n.º 2
0
 def update(self,request,ID):
     vendor= Vendor.get_by_id(int(ID))
     serializer = VendorUpdateSerializer(data=request.data)
     if serializer.is_valid():
         vendor.name=serializer.validated_data.get('name')
         vendor.service_type = serializer.validated_data.get('service_type')
         vendor.address = serializer.validated_data.get('address')
         vendor.contact_no_1 = serializer.validated_data.get('contact_no_1')
         vendor.contact_no_2 = serializer.validated_data.get('contact_no_2')
         vendor.put()
         return Response(serializer.data, status=status.HTTP_201_CREATED)
     return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Ejemplo n.º 3
0
 def destroy(self,request,ID):
     vendor =Vendor.get_by_id(int(ID))
     print vendor
     vendor.key.delete()
     return Response(status=status.HTTP_204_NO_CONTENT)
Ejemplo n.º 4
0
 def retrieve(self,request,ID):
     queryset =Vendor.get_by_id(int(ID))
     serializer = VendorUpdateSerializer(queryset)
     return Response(serializer.data)