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:
@@ -7,22 +7,10 @@ from django.apps import apps
|
||||
from django.utils import six
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
from mayan.apps.common.classes import PropertyHelper
|
||||
|
||||
__all__ = ('WorkflowAction',)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DocumentStateHelper(PropertyHelper):
|
||||
@staticmethod
|
||||
@property
|
||||
def constructor(*args, **kwargs):
|
||||
return DocumentStateHelper(*args, **kwargs)
|
||||
|
||||
def get_result(self, name):
|
||||
return self.instance.workflows.get(workflow__internal_name=name)
|
||||
|
||||
|
||||
class WorkflowActionMetaclass(type):
|
||||
_registry = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user