Hi Timothy, thanks for your advice.
I'm sorry, I've been quite busy lately on other stuff so I had to leave
this apart. You are right, maybe I am overcomplicating things. I have
simplified my code to:
def get_readonly_fields(self, request, obj=None):
if not
Hi,
It was something like that:
def get_form(self, request, obj=None, **kwargs):
if not request.user.groups.filter(name__exact='administration')
and not request.user.is_superuser:
import itertools
self.readonly_fields = itertools.chain(self.readonly_fields,
On Thu, Oct 10, 2013 at 10:04 AM, Roberto López López
wrote:
> This is, for example, my code overriding get_readonly_fields():
>
> def get_readonly_fields(self, request, obj=None):
> readonly = super(NewsAdmin, self).get_readonly_fields(request, obj)
> if
This is, for example, my code overriding get_readonly_fields():
def get_readonly_fields(self, request, obj=None):
readonly = super(NewsAdmin, self).get_readonly_fields(request, obj)
if request.user.groups.filter(name__exact='administration') or
request.user.is_superuser:
Can you post the code you tried with get_form()? It should be the solution.
On Thu, Oct 10, 2013 at 9:45 AM, Roberto López López
wrote:
> Hi,
>
> In my project I make use of django-admin. I need to have different
> readonly_fields depending on the user is connected, thus
Hi,
In my project I make use of django-admin. I need to have different
readonly_fields depending on the user is connected, thus administrators
will be able to modify all fields, and other users less fields. Which
method do I have to override? I have already tried
ModelAdmin.get_readonly_fields()
6 matches
Mail list logo