Skip to content

Instantly share code, notes, and snippets.

@ewelina29
Last active April 10, 2021 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ewelina29/d4bf88c1215feb99286f1e369d50caa5 to your computer and use it in GitHub Desktop.
Save ewelina29/d4bf88c1215feb99286f1e369d50caa5 to your computer and use it in GitHub Desktop.
class PizzaListCreateAPIView(generics.ListCreateAPIView):
queryset = Pizza.objects.all()
def get_serializer_class(self):
if self.request.method == 'POST':
return PizzaCreateSerializer
return PizzaListSerializer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment