So you need dynamic form as below
Class MyForm(forms.ModelForm): fields ....... def __init__(self, user,*args , **kwargs): super(MyForm,self).__init__(*args,**kwargs) if user is not superuser : self.fields['title'].widget.attrs['readonly'] = True i hope the code will work. On May 14, 5:56 pm, duikboot <dijkstra.ar...@gmail.com> wrote: > Hi, is there a way to have a field editable by the superuser but not > by another logged in user, in the admin area? > The rest of the model should be editable by the logged in user. > > example: > > class Test(models.Model): > title = models.CharField(max_length=150) > page = models.TextField() > > So page should be editable for the logged in user, but title should > only be editable by the superuser. > > Any ideas? Thanks, > > Duikboot --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---