What happened : I'm learning django Of form When the component , Yes, it doesn't conform to form Component defined fields cannot be submitted , As a result, customized error messages cannot be displayed .( Because failure to submit means that the data has not been transferred to the background , Then your error echo is returned to the front end after the data is found to be inconsistent in the background inspection ) This is obviously an unreasonable design for users , Not allowed to submit without telling me what went wrong .
Cause of error : In direct use form When components are rendered , If you set a required field ( Default is also required ), Well, the... Of this field input The label will have required This attribute , If not , When the front end finds that the value is empty, it is not allowed to submit , So we just need to form Add attribute value to the tag novalidate, It means that the input field is not checked .
resolvent : stay form Add... After the label novalidate, No input validation for this form .
summary : In the past, when writing front-end forms, you always wrote a type and name , No other properties have been used at all , So this time, I also suffered the loss of not understanding the front end . Thanks to the documents I read for a long time , Look at the source code earlier , Look at what he is rendering. It may have been solved long ago .