Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#16707 closed Cleanup/optimization (wontfix)

Form.is_valid should be a property.

Reported by: Marc Tamlyn Owned by: Marc Tamlyn
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

Description

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: https://github.com/django/django/pull/35

Change History (2)

comment:1 Changed 5 years ago by Malcolm Tredinnick

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: wontfix
Status: newclosed

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 5 years ago by Marc Tamlyn

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