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
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
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
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.
4 matches
Mail list logo