Add the RecentDocument mixin
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
15
mayan/apps/documents/mixins.py
Normal file
15
mayan/apps/documents/mixins.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
|
||||
class RecentDocumentMixin(object):
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
result = super(RecentDocumentMixin, self).dispatch(
|
||||
request=request, *args, **kwargs
|
||||
)
|
||||
self.get_recent_document().add_as_recent_document_for_user(
|
||||
user=request.user
|
||||
)
|
||||
return result
|
||||
|
||||
def get_recent_document(self):
|
||||
return self.object
|
||||
Reference in New Issue
Block a user