Good Morning I made a control of user sessions through login and logout: In login before logging it does an insert in my table:
cursor.execute("INSERT INTO usuarios_sessoes (usuario, datahorainicio) VALUES ('%s', '%s')" % (str(username),timezone.now().strftime('%d/%m/%Y %H:%M:%S')))
and logout does update:
cursor.execute("""select id
from usuarios_sessoes
where usuario='"""+str(request.user)+"""'
order by datahorainicio desc limit 1""")
id = cursor.fetchone()[0]
With this I have my session control, but what I need is that a superuser, can move any user, I did not find a solution for that.