I'm new to learning Django. I want to find the documentation regarding the readonly attribute you can set for admin widgets. For example, from an admin.py:class SourceForm(forms.ModelForm):data = forms.CharField(widget=TextInput(attrs={'readonly': True, 'class': 'averageField'})) class Meta:model = Sourceclass SourceAdmin(admin.ModelAdmin):form = SourceFormadmin.site.register(Source, SourceAdmin)I've search for readonly on https://docs.djangoproject.com/search/?q=readonly& but did not found anything. Also searching manually in https://docs.djangoproject.release=7 com/en/dev/ref/forms/widgets/ didn't bring anything up. Can someone tell me where I'm going wrong please.
This is not documented on the Django site because it has nothing to do with Django. As the docs do explain, the `attrs` are used to set any HTML attributes on the rendered widget. `readonly` is an attribute belonging to the HTML input and select elements.
--
DR.
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment