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:
15
mayan/apps/document_states/methods.py
Normal file
15
mayan/apps/document_states/methods.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
def method_get_workflow(self, name):
|
||||
return self.workflows.get(workflow__internal_name=name)
|
||||
|
||||
|
||||
method_get_workflow.short_description = _(
|
||||
'get_workflow(< workflow internal name >)'
|
||||
)
|
||||
method_get_workflow.help_text = _(
|
||||
'Return the current state of the selected workflow.'
|
||||
)
|
||||
Reference in New Issue
Block a user