Пример #1
0
	def get(self,request,format=None):
		# query params
		title = ModelHelper().title_param(request)
		if title:
			profile = ModelHelper().get_by_title(title)
			if profile:
				serializer_class = ProfileSerializer 
				serialized_profile = ProfileSerializer(profile).data
				return Response(serialized_profile,status=status.HTTP_200_OK)
			else:
				return Response('There was no title matching that query param')
		
		profiles = APIGenericGenerator(model=Profile,serializer=ProfileSerializer)
		
		return Response(profiles.list(),status=status.HTTP_200_OK)
Пример #2
0
	def get(self,request):
		fundraisers = APIGenericGenerator(model=Fundraiser,serializer=FundraisersSerializer)
		return Response(fundraisers.list_paginated_results(request,sort='-created'),status=status.HTTP_200_OK)
Пример #3
0
	def get(self,request):
		profiles = APIGenericGenerator(model=Profile,serializer=ProfileSerializer)
		return Response(profiles.list_paginated_results(request,sort='organization'))
Пример #4
0
	def get(self,request):
		products = APIGenericGenerator(model=Product,serializer=ProductSerializer)
		return Response(products.list_paginated_results(request,sort='category'))