readthedocs.org icon indicating copy to clipboard operation
readthedocs.org copied to clipboard

Form: prevalidation form tuning

Open agjohnson opened this issue 2 years ago • 0 comments

A few notes to come back to for tuning on this pattern:

  • [ ] Turn the prevalidate form into a mixin, so that the base form can be forms.Form or forms.ModelForm without struggling with any conflicts. Maybe this isn't necessary.
  • [ ] is_disabled should reference self.errors I think. This would populate the prevalidation errors if form.errors wasn't called first. The use case here is when displaying the form, we might use <form {% if form.is_disabled %}inert{% endif %}> before we actually call {{ form | crispy }}. The crispy filter calls form.errors which populates all the validation errors.
  • [ ] https://github.com/readthedocs/ext-theme/issues/279 -- a few options here are <form inert>, disabling all of the fields in the Form class, or wrapping with .ui.disabled.segment instead. There is no .ui.disabled.form unfortunately.
  • [ ] Revisit disabling forms pattern in #10656 and related PR

agjohnson avatar Apr 10 '24 23:04 agjohnson