Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#16707 closed Cleanup/optimization (wontfix)

Form.is_valid should be a property.

Reported by: mjtamlyn Owned by: mjtamlyn
Component: Forms Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Reasoning: It depends on a property (Form.errors) which is where the work happens. Calling Form.is_valid() twice doesn't validate the form twice. It seems a similar situation to HttpRequest.is_ajax.

See pull request here:

Change History (2)

comment:1 Changed 4 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

This would be backwards incompatible. The is_valid() function is part of the public API. There's no strong disadvantage to it being a method call in any case, so let's not over-think it.

comment:2 Changed 4 years ago by mjtamlyn

Fair point. It would be a faff to make it backwards compatible. I'll withdraw the pull req. too.

Note: See TracTickets for help on using tickets.
Back to Top