Re: Making A Field Read Only

2019-11-07 Thread Derek
https://docs.djangoproject.com/en/2.2/ref/models/fields/#editable On Wednesday, 6 November 2019 18:35:48 UTC+2, Ray Z wrote: > > Hey Everyone, > > Im very new to django and im trying to figure out how to make a field on > a forum read only. The field is my date created field that has a

Making A Field Read Only

2019-11-06 Thread Ray Z
Hey Everyone, Im very new to django and im trying to figure out how to make a field on a forum read only. The field is my date created field that has a automatic timestamp. The form structure im using is a modelform . Here is my code of my forms.py . I appreciate the help. Thank you everyone

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

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.