- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我想建立一个 django 站点,其中一组受信任的用户可以编辑他们的个人资料信息。让每个受信任的用户都通过 django 管理界面是否有意义?我只希望他们能够查看和编辑自己的信息(显然)。这似乎不符合 django 人定义“信任”的方式,尤其是粗体部分......
来自 The Django Book, Chapter 18 :
The admin is designed to be used by people who you, the developer, trust. This doesn’t just mean “people who have been authenticated;” it means that Django assumes that your content editors can be trusted to do the right thing.
This means that there’s no “approval” process for editing content — if you trust your users, nobody needs to approve of their edits. It also means that the permission system, while powerful, has no support for limiting access on a per-object basis. If you trust someone to edit their own stories, you trust them not to edit anyone else’s without permission.
这是适合 django 的管理模块的那些用例之一,还是它只是一个不受信任的用户的专用 View ?
最佳答案
不,Django 管理不适合个人用户配置文件,每个用户都可以查看和编辑所有其他用户配置文件。这更适合必须同时管理所有用户的管理员。
您需要构建的是用户个人资料页面。 Django 已经有一个很好的登录系统,由 django.contrib.auth 模块提供。您可以轻松地将其集成到您的页面中,这正是 Django 管理员用来验证用户身份的内容。
接下来,您必须构建一个简单的页面,以根据用户模型公开该特定用户的个人资料信息。这应该相对轻松,因为它只需要一个 View 和一个模板,并且模板可以利用 ModelForms。
关于python - Django 管理员的有效用例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/498199/
我最近购买了《C 编程语言》并尝试了 Ex 1-8这是代码 #include #include #include /* * */ int main() { int nl,nt,nb;
早上好!我有一个变量“var”,可能为 0。我检查该变量是否为空,如果不是,我将该变量保存在 php session 中,然后调用另一个页面。在这个新页面中,我检查我创建的 session 是否为空,
我正在努力完成 Learn Python the Hard Way ex.25,但我无法理解某些事情。这是脚本: def break_words(stuff): """this functio
我是一名优秀的程序员,十分优秀!