I use modelformset factory to create a set of forms from model fields. Here I want to make only request objects as readonly and others (additional forms) as fields without reading
How can i achieve this?
AuthotFormSet = modelformset_factory(Author, extra=2,)
formset = AuthorFormSet(queryset=Author.objects.all())
In Above formset, I wanted to display all the request objects as readonly, and the remaining additional forms as fields that were not readonly. How can i achieve this?
if i used
for form in formset.forms:
form.fields['weight'].widget.attrs['readonly'] = True
This will convert all forms (including optional ones) to readonly, which I don't want. And also I use jquery plugin to dynamically add form to formet
source
share