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, ('is_featured', )) return super(NewsAdmin, self).get_form(request, obj, **kwargs) Now I see that this was slightly different than what I did with get_readonly_fields... On 10/10/2013 03:00 PM, Timothy W. Cook wrote: > 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 > <roberto.lo...@uni.no <mailto:roberto.lo...@uni.no>> 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 > 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() and ModelAdmin.get_form(). But no > success. > > Any other suggestions? > > Thanks! > > Roberto > > > -- > You received this message because you are subscribed to the Google > Groups "Django users" group. > To unsubscribe from this group and stop receiving emails from it, > send an email to django-users+unsubscr...@googlegroups.com > <mailto:django-users%2bunsubscr...@googlegroups.com>. > To post to this group, send email to django-users@googlegroups.com > <mailto:django-users@googlegroups.com>. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/5256A163.3000907%40uni.no. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > MLHIM VIP Signup: http://goo.gl/22B0U > ============================================ > Timothy Cook, MSc +55 21 94711995 > MLHIM http://www.mlhim.org > Like Us on FB: https://www.facebook.com/mlhim2 > Circle us on G+: http://goo.gl/44EV5 > Google Scholar: http://goo.gl/MMZ1o > LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook > -- > You received this message because you are subscribed to the Google > Groups "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3V6vOGGaG7_M9xmEPY232%3DpVXqMKSrxH-hMbCOwDo2Axg%40mail.gmail.com. > For more options, visit https://groups.google.com/groups/opt_out. -- Roberto López López System Developer Parallab, Uni Computing +47 55584091 -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5256C126.5080909%40uni.no. For more options, visit https://groups.google.com/groups/opt_out.