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

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

问题描述

我最近开始使用django来管理一个大量的现有应用程序,这些应用程序多年来一直在使用twisted.web。我开始尝试使用django,它是自动的管理界面,我对结果非常满意。



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



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



更新:Django管理员似乎给了我一个CRUD界面的CUD。如何获得具有相关权限和组的只读部分?



更新2010年2月12日:Django 1.2现在将包含只读。






我回答了我自己的问题。将内容移至下面的真实答案。

解决方案

现在包含将只读字段添加到管理视图的功能在Django版本1.2。



查看票号342
http://code.djangoproject.com/ticket/342



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



请参阅文档
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields


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.

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?

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?

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.

解决方案

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

See ticket number 342 http://code.djangoproject.com/ticket/342

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

See documentation http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields

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

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