id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 33040 BaseModelForm.is_valid() should document how it modifies the BaseModelForm.instance Danang Rahmatullah nobody "`BasedModelForm` extends `BaseForm`. When `BaseModelForm().is_valid()` is called, its super is called which in turn calls `BaseForm.errors` (property method). The issue is when there are no errors (self._errors is None): `BaseForm` calls `full_clean()` which runs the `_post_clean()` hook defined in `BaseModelForm`, finally modifying `BaseModelForm.instance`. Given the abstraction level of subclasses of `BaseModelForm` such as `forms.ModelForm`, it is very unreasonable to expect that a seemingly simple function like `is_valid()` to create such a big change to a property as important as `instance`. I hope this side-effect is clearly explained in the documentation or have the code refactored to separate the modifying effect of `is_valid()` function from the form validity check {{{ #!python # form.instance.myfield = False form = MyModelForm(instance=myinstance, data={""myfield"": True}) # form.instance.myfield = False form.is_valid() # form.instance.myfield = True }}}" Uncategorized closed Documentation 3.2 Normal invalid BaseModelForm is_valid Unreviewed 0 0 0 0 0 0