-
-
Save triump0870/9ab4fb87cb3de3b1f1b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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