将图像字段添加到 django 中的 admin.auth 管理站点
您好,我还没有找到任何人试图解决这个问题,所以我想我在这里问这个问题。基本上我试图将图像字段添加到与我的用户配置文件模型相关的 admin.auth 用户管理站点。
除了注册网站的用户之外,管理员在管理网站中创建用户时还需要能够指定个人资料图片,该图片将用于他们在新闻和博客等上发布的帖子。
这是否可能,我让用户配置文件模型正常工作,这将允许我添加图像,但我想在管理员创建新用户时将其包含在管理员用户面板中。
非常感谢任何帮助!
提前致谢
Hi ive not be able to find any one trying to solve this issue yet so i thought id ask the question here. Basically im trying to add an image field to the admin.auth users admin site that relates to my userprofile model.
Aswell as users that register to the site, the admins need to be able to specify a profile picture when the create a user in the admin site that will be used for posts they make to news and blogs etc.
Is this at all possible, i have the userprofile model working which will allow me to add the image but i want to include this in the admin user panel when an admin creates a new user.
Any help is greatly appreciated!!
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将您的 UserProfile (带有额外的图像字段)添加为 内联到用户adminModel。因此,当您进入 admin.auth 面板添加新用户时,其下方将有一个内联内容,其中包含所有 UserProfile 字段。
像这样的事情应该做到这一点(在您的用户配置文件所在的任何应用程序的 admin.py 中):
You can add your UserProfile (with the extra image field) as an inline to the User adminModel. So when you go to the admin.auth panel to add a new user, there will be an inline below it with all the UserProfile fields.
Something like this should do it (in admin.py of whatever app your userprofile is in):