By coincidence I blogged last night right about read permissions how you need
them [1]. My solution is like what you explain as "dirty hack" ;)

It provides this functionality:

* Every user with is_staff=True can read all objects in the admin.
* View permission means: You can see the usual change form but you cannot save
  the form

There is a small drawback: If a user has no other permissions (like
change/add/delete permissions) the model will not show up in admin's index
page. Maybe this is not a problem for you if you have a custom admin index
page.

[1] http://gremu.net/blog/2010/django-admin-read-only-permission/

--
Servus,
Gregor Müllegger

2010/7/2 Josh Ourisman <[email protected]>:
> All of this stuff is absolutely doable, and in fact I've implemented much of
> it myself. I don't know if it will cover everything you want, but I've
> written up some of my most similar Django Admin hacks (I've done quite a bit
> over the years...) on my blog
> here: http://joshourisman.com/2009/10/15/django-admin-awesomeness/
> That said, 1.2 introduced object-level permissions hooks which are not used
> in my (Django 1.1) code
> above: http://docs.djangoproject.com/en/dev/releases/1.2/#object-level-permissions
> But above all, thanks for sharing this awesome story! I love hearing about
> the amazing ways that people are using Django, and the way it can facilitate
> rapid response to actual, serious problems (I think perhaps my favorite,
> most inspiring Django story was Andy McCay's on how it's being used to fight
> malnutrition in Africa from
> DjangoCon http://www.slideshare.net/andymckay/fighting-malnutrition-with-sms-and-django).
> As an aside, is there much of a Django community in Iceland? I was there for
> the first time last Fall and absolutely loved the country; would love to
> spend more time there.
>
> On Fri, Jul 2, 2010 at 9:30 AM, Ramsey D'silva <[email protected]>
> wrote:
>>
>> I believe all the things you mentioned, can be done! It's just a matter of
>> finding a competent developer.
>>
>> Cheers!
>>
>> On 2-Jul-10, at 7:03 AM, Helgi Borg wrote:
>>
>>> Remember the Eyjafjallajökull eruption that stopped air traffic over
>>> parts of Europe?  The staff at the Icelandic Meterological Office had
>>> a seriously busy time the first days of the eruption. When I arrived
>>> at work the first morning, I quickly realized that we needed a simple
>>> msg-software so the teams of meteorologists, geologists, hydrographers
>>> and the executives could better synchronize their work. In a few
>>> hours, I had implemented, tested and deployed a Django app that helped
>>> a lot. - Django is truly an amazing piece of software. Thank you for
>>> Django!
>>>
>>> The Django app was reasonable good although not perfect. Let me
>>> explain why…
>>>
>>> I needed every user to be able to view messages from anyone. Members
>>> of the same teams (users of the same Auth. group) needed to be able to
>>> correct messages from each other for some time until the messages
>>> automatically locked for changes.
>>>
>>> The obvious choose was to use the Contrib Admin. It is robust, fast,
>>> easy for developers to use, easy for users to get used to and has a
>>> persistent user interface. In other words it is almost perfect for all
>>> our data registration usage except that it doesn’t have view
>>> permissions. The ModelAdmin class would be perfect if it only had view
>>> permissions (perhaps read permission is a better word).
>>>
>>> A dirty solution is to apply change permission to “view only
>>> permission-users” and then use save_model() to deny these users  to
>>> actually change view-only instances. The practical problem with this
>>> is that the UI indicates that the user can change something that he/
>>> she may not change.
>>>
>>> One could argue that I should use something else than Contrib Admin.
>>> The problem is that there is nothing else as good available. Mixing
>>> Contrib Admin with other app for view-only purposes results in bad
>>> usability. Further it doesn’t adhere to the DRY principle to create
>>> something new when you have something as good as Contrib Admin.
>>>
>>> I’ve also created other apps where I’ve needed view permission. These
>>> are Avalanche registration, Registration of ash fall, Sea ice
>>> registration, Warning registration and Weather forecasters self
>>> quality monitoring. Other apps will most likely follow.
>>>
>>> I would really appreciate if you could answer the following questions:
>>> 1)      Is there any change that you might consider adding view
>>> permissions
>>> to the Contrib Admin?
>>> 2)      If not, may I ask what the reason is?
>>> 3)      Can I add view permissions functionality on top of the Contrib
>>> Admin without changing its interior, thus avoiding problems on next
>>> Django update?
>>> 4)      If not, are there many changes planned for the Contrib Admin on
>>> next release -- would it be wise for me to add it my self?
>>> 5)      I’m new to Django. Am I perhaps getting something totally wrong?
>>>
>>> Best regards,
>>> Helgi Borg
>>> The Icelandic Meteorological Office
>>> http://en.vedur.is
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django developers" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-developers?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/django-developers?hl=en.
>>
>
>
>
> --
> Josh Ourisman
> www.joshourisman.com
> (301) 244-9674
> Washington DC
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to