Is it possible in django when user is login that time user active login browser name store in database?

Django in we already store session details in django_session, and last_login in the auth_user table but I want to store when user login in browser that time browser name store in the database.

I already do: get browser name in frontend page from active browser with the use of javascript but actually, I want its store in the database.

This is my javascript code for get browser name :

    <!DOCTYPE html>
<html>
<body>
<div id="demo"></div>
<script>
    let browserName = "";
    if(navigator.vendor.match(/google/i)) {
        browserName = 'Browser Name: Google Chrome';
    }
    else if(navigator.vendor.match(/apple/i)) {
        browserName = 'Browser Name: Apple Safari';
    }
    else if(navigator.userAgent.match(/firefox\//i)) {
        browserName = 'Browser Name: Mozila Firefox';
    }
    else if(navigator.userAgent.match(/edge\//i)) {
        browserName = 'Browser Name: Microsoft Edge';
    }
    else if(navigator.userAgent.match(/trident\//i)) {
        browserName = 'Browser Name: Internet Explorer';
    }
    else
    {
        browserName = navigator.userAgent + "\n" + navigator.vendor;
    }
</script>
	<h2><script type="text/javascript">document.write(browserName)</script></h2>
</body>
</html>

I hope you understand my question. :slight_smile:

You dont need JS to get Browser.

Django has request.META who can handle with that.

So, just create a custom LOGIN view that get USER_AGENT and update the User Model, or you can create a custom middleware that store the information every time that user access.

Take a look at this project. It does not store browser, but give you util information about user, and of course you can store this information “on login”.