Files
mayan-edms/mayan/apps/checkouts/methods.py
Roberto Rosario 456c322c19 Move add_to_class functions to their own module
* The new module is called methods.py and found on each app.
* Add keyword arguments to add_to_class instances.
* Remove catch all exception handling for the check in and
  check out views.
* Improve checkouts tests code reducing redundant code.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2019-04-11 18:03:53 -04:00

35 lines
950 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_check_out_info(self):
DocumentCheckout = apps.get_model(
app_label='checkouts', model_name='DocumentCheckout'
)
return DocumentCheckout.objects.get_check_out_info(document=self)
def method_get_check_out_state(self):
DocumentCheckout = apps.get_model(
app_label='checkouts', model_name='DocumentCheckout'
)
return DocumentCheckout.objects.get_check_out_state(document=self)
def method_is_checked_out(self):
DocumentCheckout = apps.get_model(
app_label='checkouts', model_name='DocumentCheckout'
)
return DocumentCheckout.objects.is_checked_out(document=self)