简体   繁体   English

如何在django admin中添加经过身份验证的用户的IP地址

[英]How to add IP address of authentificated users in django admin

Could you please help me with Django-Admin part in order to save and see the last used IP address for the authenticated user(session). 您能否在Django-Admin部分中为我提供帮助,以保存并查看已认证用户(会话)的上次使用IP地址。

In my understanding I have to customize the user model but how to do this in the best easiest way ? 以我的理解,我必须自定义用户模型,但是如何以最简单的方式做到这一点? Also at what time/state/moment should I define IP for for the User model ? 还要在什么时间/状态/​​时刻为用户模型定义IP?

I expect to have additional field in the User model which contains the last used client IP 我希望用户模型中具有其他字段,其中包含最近使用的客户端IP

I'd highly recommend installing django-useraudit in your app. 我强烈建议您在应用中安装django-useraudit It will store more than the last successful login IP Address. 它存储的将超过最后一次成功登录的IP地址。 It will save (for both successful and failed* login attempts): 这将节省(对于成功和失败的*登录尝试):

  • Username 用户名
  • IP address IP地址
  • Forwarded by 转发者
  • User Agent 用户代理
  • Timestamp 时间戳

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM