Skip to content

Instantly share code, notes, and snippets.

@triump0870
Created December 1, 2015 12:49
Show Gist options
  • Save triump0870/9ab4fb87cb3de3b1f1b3 to your computer and use it in GitHub Desktop.
Save triump0870/9ab4fb87cb3de3b1f1b3 to your computer and use it in GitHub Desktop.
class LastLogin(APIView):
def get_object(self,pk):
try:
return User.objects.get(pk=pk)
except:
return Http404
def get(self, request, pk):
obj = self.get_object(pk)
email = obj.email
last_login = obj.last_login
data = {'email':email,'last_login':last_login}
return Response(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment