Ejemplo n.º 1
0
 def viewEvent(self, request, *args, **kwargs):
     try:
         query = Event.objects.get(id = self.request.data.get('event_id'))
         serial = eventSerializer.EventSerializer(query)
         return Response(serial.data)
     except Exception:
         return Response("error")
 def joinEvent(self, request, *args, **kwargs):
     queryset = Event.objects.filter(
         event_id=self.request.data.get('event_id'))
     serializer_class = eventSerializer.EventSerializer(queryset)
     return Response(serializer_class.data)
 def getAllEvents(self, request, *args, **kwargs):
     events = Event.objects.all()
     serializer = eventSerializer.EventSerializer(events, many=True)
     return Response(serializer.data)
 def viewMyEvents(self, request, *args, **kwargs):
     # TODO: should  filter have a parameter passed to it? Yes: need to have vendor/user id
     events = Event.objects.filter()
     serializer = eventSerializer.EventSerializer(events, many=True)
     return Response(serializer.data)
Ejemplo n.º 5
0
 def getVendorEvents(self, id):
     return eventSerializer.EventSerializer(
         Event.objects.filter(vendor_id=id), many=True).data
Ejemplo n.º 6
0
 def editMyEvents(self, request, *args, **kwargs):
     event = Event.objects.get(id=request.data.get("event_id"))
     event.vendor_id = request.data.get("vendor_id")
     event.save()
     serial = eventSerializer.EventSerializer(event)
     return Response(serial.data)
Ejemplo n.º 7
0
 def listEvent(self, request, *args, **kwargs):
     eventset = Event.objects.filter(id=self.request.data.get('event_id'))
     results = eventSerializer.EventSerializer(eventset)
     return Response(results.data)