如何修改 django 以创建“视图"?允许? [英] How can I MODIFY django to create "view" permission?

查看:11
本文介绍了如何修改 django 以创建“视图"?允许?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用 django 来管理一个大型现有应用程序,该应用程序是多年来使用 twisted.web 有机发展起来的.我开始尝试使用 django 和它的自动管理界面,我对结果非常满意.

I've recently started using django to administer a large existing application that was grown organically over the years using twisted.web. I started experimenting with django and it's automatic admin interface and I've been very pleased with the results.

就我的目的而言,似乎缺少的一件事是赋予用户对数据的只读访问权限的能力.例如,我们有一个角色允许人们登录并创建采购订单.他们还需要能够查看但不能编辑其他客户或产品数据.

One thing that seems to be missing for my purposes is the ability to give users read only access to data. For instance we have a role where people are allowed to login and create purchase orders. They also need to be able to view, but not edit other client or product data.

如何在 django 管理员中创建查看"权限,以便用户可以修改某些表的数据,同时对其他表具有只读访问权限?

How would I create "view" permissions in the django admin so users can modify data for some tables, while having read only access to others?

更新:Django Admin 似乎给了我一个 CRUD 接口的 CUD.如何获得具有关联权限和组的只读部分?

Update: Django Admin appears to give me the CUD of a CRUD interface. How do I get the Read Only part with associated permissions and groups?

2010 年 2 月 12 日更新:Django 1.2 现在将包括只读.详情如下.

Update 2010-Feb-12: Django 1.2 will now include read-only. Details below.

我猜我回答了我自己的问题.将内容移至下方的真实答案.

I answered my own question I guess. Moving the content down to a real answer below.

推荐答案

现在 Django 1.2 版中包含向管理视图添加只读字段的功能.

The ability to add read-only fields to the admin view is now included in Django version 1.2.

见票号 342http://code.djangoproject.com/ticket/342

查看变更集编号 11965http://code.djangoproject.com/changeset/11965

See changeset number 11965 http://code.djangoproject.com/changeset/11965

查看文档http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields

这篇关于如何修改 django 以创建“视图"?允许?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆