Add history events 'check out' and 'check in' logging

This commit is contained in:
Roberto Rosario
2012-06-17 00:39:54 -04:00
parent a6e1df9b3a
commit 0e47bbb10b
5 changed files with 37 additions and 15 deletions

View File

@@ -9,9 +9,11 @@ from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from documents.models import Document
from history.api import create_history
from .managers import DocumentCheckoutManager
from .exceptions import DocumentAlreadyCheckedOut
from .events import HISTORY_DOCUMENT_CHECKED_OUT
logger = logging.getLogger(__name__)
@@ -42,7 +44,7 @@ class DocumentCheckout(models.Model):
if not self.pk:
self.checkout_datetime = datetime.datetime.now()
result = super(DocumentCheckout, self).save(*args, **kwargs)
#create_history(HISTORY_DOCUMENT_DELETED, data={'user': request.user, 'document': document})
create_history(HISTORY_DOCUMENT_CHECKED_OUT, source_object=self.document, data={'user': self.user_object, 'document': self.document})
return result
@models.permalink