Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] computed writable inheritance compatibility guideline #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions website/Contribution/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,20 @@ Models
* Method conventions

* Compute Field: the compute method pattern is `_compute_<field_name>`

* Computed writeable fields (computed fields with *store=True* and
*readonly=False*, since v13), in the sake of inheritance compatibility,
should define this code if the compute method is added in a module that
is not the one that originally defines the field (which means that
originally the field was not computed):

.. code-block:: python

def _compute_field(self):
if hasattr(super(), "_compute_field"):
super()._compute_field()
# rest of the compute method

* Inverse method: the inverse method pattern is `_inverse_<field_name>`
* Search method: the search method pattern is `_search_<field_name>`
* Default method: the default method pattern is `_default_<field_name>`
Expand Down