Exemple #1
0
 def get_basic(self, request, pk=None):
     serializer = self.serializer_class(data=request.data)
     if serializer.exists():
         user = User.objects.get(email=serializer.data['email'])
         return Response(
             {
                 'name': str(user),
                 'profile': File.selfie(user),
                 # Add level later when game-ifying
             },
             status=status.HTTP_200_OK)
     else:
         return Response(serializer.email_error,
                         status=status.HTTP_400_BAD_REQUEST)
Exemple #2
0
    def get_file_names(self, request, pk=None):
        serializer = self.serializer_class(data=request.data)

        if serializer.exists():
            user = User.objects.get(email=serializer.data['email'])
            id_file = File.id_file(user)
            selfie = File.selfie(user)

            return Response(
                {
                    'selfie': selfie.name if selfie else '',
                    'id_file': id_file.name if id_file else '',
                },
                status=status.HTTP_200_OK)
        else:
            return Response(serializer.errors,
                            status=status.HTTP_400_BAD_REQUEST)