Skip to content

Instantly share code, notes, and snippets.

@sankalpjonn
Created June 27, 2021 02:23
Show Gist options
  • Save sankalpjonn/a3b2978c1104256c55cdc909c80d32b4 to your computer and use it in GitHub Desktop.
Save sankalpjonn/a3b2978c1104256c55cdc909c80d32b4 to your computer and use it in GitHub Desktop.
from rest_framework import generics
from django.shortcuts import get_object_or_404
class RecordRetrieveView(generics.RetrieveAPIView):
serializer_class = RecordSerializer
def get_object(self):
return get_object_or_404(Record, id=self.request.query_params['id'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment