Ejemplo n.º 1
0
	def get(self,request):
		fundraisers = ModelHelper().filter_by_id(request,id)

		if fundraisers:
			return Response(FundraisersSerializer(fundraisers,many=True).data,status=status.HTTP_200_OK)
		return Response('Failure',status=status.HTTP_404_NOT_FOUND)

		fundraisers = APIGenericGenerator(model=Fundraiser,serializer=FundraisersSerializer)
		return Response(fundraisers.list(sort='-created'),status=status.HTTP_200_OK)
Ejemplo n.º 2
0
    def get(self, request, format=None):
        params = request.GET
        helper = ModelHelper()

        if "firstName" in params:
            results = helper.filter_by_first_name(params["firstName"])
            serialized_results = ContactSerializer(results, many=True).data
            return Response(serialized_results)
        elif "lastName" in params:
            results = helper.filter_by_last_name(params["lastName"])
            serialized_results = ContactSerializer(results, many=True).data
            return Response(serialized_results)

        return Response("Failure")