首页 > 解决方案 > 尝试在 Django 管理面板中删除用户时出现编程错误

问题描述

我在网上找到了一个网页,一切正常。除非我尝试删除用户,否则我收到以下错误:

{ProgrammingError at /admin/auth/user/ 
operator does not exist: text = integer
LINE 1: ...OIN "auth_user" ON ("avtimessolver"."employee_id" = "auth_us...
                                                         ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.}

我将 Django 与 nginx、gunicorn 和 postgresql 一起使用。

我的模型有什么问题吗?表 avtimessolver 是由一种算法生成的,我将 id 保存为名称,以便 Django 在某些查询中显示名称而不是 id。

有没有办法在不更改表的情况下解决这个问题,以便删除函数也接受用户名作为输入?

任何帮助表示赞赏。

标签: djangodjango-authenticationdjango-database

解决方案


推荐阅读