Search code examples
djangodjango-admindjango-permissions

How can I MODIFY django to create "view" permission?


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.


Solution

  • 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