Re: Making a field Read-Only in Django

2014-11-17 Thread Patrick Beeson
I believe you can set this via a built-in widget's attrs: somefield = forms.CharField( widget=forms.TextInput(attrs={'readonly':'readonly'})) On Monday, November 17, 2014 1:48:44 AM UTC-5, Frankline wrote: > > Hi all, > > I'm running Django 1.7 and Python 3.4. I'm trying to make the username

Making a field Read-Only in Django

2014-11-16 Thread Frankline
Hi all, I'm running Django 1.7 and Python 3.4. I'm trying to make the username field of my custom model to be read-only. I think this is usually set in the form. Below is what I currently have in my *forms.py* class AuthUserChangeForm(UserChangeForm): """ A form for updating users. Includ