I am trying to set a readonly attribute to this specific field in django. What I hope to accomplish is the field's data shows but it cant be changed. How do I go about this? Below is what I've tried and isn't working for me.
class editcartform(ModelForm):
class Meta:
model = signedup
exclude = ['sessionid', 'price', 'paid', 'orderid', 'dancer_1_level', 'dancer_2_level', 'dancer_2_sex', 'dancer_1_sex']
widgets = {
'comp_name':Textarea(attrs={'readonly'}),
}