why are read only form fields in django a bad idea?

Posted by jamida on Stack Overflow See other posts from Stack Overflow or by jamida
Published on 2010-05-25T04:32:41Z Indexed on 2010/05/25 4:41 UTC
Read the original article Hit count: 944

I've been looking for a way to create a read-only form field and every article I've found on the subject comes with a statement that "this is a bad idea". Now for an individual form, I can understand that there are other ways to solve the problem, but using a read only form field in a modelformset seems like a completely natural idea.

Consider a teacher grade book application where the teacher would like to be able to enter all the students' (note the plural students) grades with a single SUBMIT. A modelformset could iterate over all the student-grades in such a way that the student name is read-only and the grade is the editable field. I like the power and convenience of the error checking and error reporting you get with a modelformset but leaving the student name editable in such a formset is crazy.

Since the expert django consensus is that read-only form fields are a bad idea, I was wondering what the standard django best practice is for the example student-grade example above?

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models