Files
mayan-edms/mayan/apps/checkouts/methods.py
Roberto Rosario 0e86f2ad8a 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>
2018-12-15 04:49:40 -04:00

34 lines
972 B
Python

from __future__ import unicode_literals
from django.apps import apps
def method_check_in(self, user=None):
DocumentCheckout = apps.get_model(
app_label='checkouts', model_name='DocumentCheckout'
)
return DocumentCheckout.objects.check_in_document(
document=self, user=user
)
def method_get_checkout_info(self):
DocumentCheckout = apps.get_model(
app_label='checkouts', model_name='DocumentCheckout'
)
return DocumentCheckout.objects.get_document_checkout_info(document=self)
def method_get_checkout_state(self):
DocumentCheckout = apps.get_model(
app_label='checkouts', model_name='DocumentCheckout'
)
return DocumentCheckout.objects.get_document_checkout_state(document=self)
def method_is_checked_out(self):
DocumentCheckout = apps.get_model(
app_label='checkouts', model_name='DocumentCheckout'
)
return DocumentCheckout.objects.is_document_checked_out(document=self)