Remove redundant query.

This commit is contained in:
Josh W 2020-03-11 12:07:24 -04:00
parent 855c747155
commit 0a6422afcd

View file

@ -96,9 +96,8 @@ class MakeRequest(APIView):
def post(self, request, format=None): def post(self, request, format=None):
serializer = MakeRequestSerializer(data=request.data) serializer = MakeRequestSerializer(data=request.data)
if serializer.is_valid(): if serializer.is_valid():
profile = RadioProfile.objects.get(user=request.user)
try: try:
profile.make_request(serializer.data['song']) request.user.profile.make_request(serializer.data['song'])
except MakeRequestError as e: except MakeRequestError as e:
return Response({'detail': str(e)}, return Response({'detail': str(e)},
status=status.HTTP_400_BAD_REQUEST) status=status.HTTP_400_BAD_REQUEST)