user_login does not log last login done

Asked

Viewed 24 times

1

I have a Python login function in the Django framework and would like to add the user_login log when the user logs in to the system. In this case, it would have to use this column already registered in the BD and do the user login date Insert, but I’m not succeeding in adding the function. In my login view it is currently like this:

class LoginView(views.APIView):
    authentication_classes = (Authentication,)

    def post(self, request):
        try:
            request_user, data = request.get_parameters(request)
            user = request.get_user_by_username(data['username'])
            update_last_login(None, user)            
        except Exception as exc:
            return None
        return response.Response(data=request.user)
  • What is the code of update_last_login?

  • @Zulo this update_last_login comes doo import from django.contrib.auth.models

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.