Refactor the model accesors

Refactor the accesors to behave like methods instead of properties.
This means all accesors will be prepended with the string
"get_" and will include a set of parenthesis.

Improve the ModeAttribute class to use the method's
short_description. This commit also adds support for a
new method .help_text attribute has been added.

Move accessors to their own module, named "methods.py".

Remove the PropertyHelper class as the accessors no longer
need it.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2018-12-15 04:49:40 -04:00
parent 8c63ef4c69
commit 0e86f2ad8a
42 changed files with 434 additions and 282 deletions
-12
View File
@@ -1,17 +1,5 @@
from __future__ import unicode_literals
from mayan.apps.common.classes import PropertyHelper
class DocumentMetadataHelper(PropertyHelper):
@staticmethod
@property
def constructor(*args, **kwargs):
return DocumentMetadataHelper(*args, **kwargs)
def get_result(self, name):
return self.instance.metadata.get(metadata_type__name=name).value
class MetadataLookup(object):
_registry = []