Render remaining date usage properly.
This commit is contained in:
@@ -13,7 +13,7 @@ from documents.views import DocumentListView
|
|||||||
|
|
||||||
from acls.models import AccessControlList
|
from acls.models import AccessControlList
|
||||||
from common.generics import ConfirmView, SingleObjectCreateView
|
from common.generics import ConfirmView, SingleObjectCreateView
|
||||||
from common.utils import encapsulate
|
from common.utils import encapsulate, render_date_object
|
||||||
from permissions import Permission
|
from permissions import Permission
|
||||||
|
|
||||||
from .exceptions import DocumentAlreadyCheckedOut, DocumentNotCheckedOut
|
from .exceptions import DocumentAlreadyCheckedOut, DocumentNotCheckedOut
|
||||||
@@ -83,7 +83,7 @@ class CheckoutListView(DocumentListView):
|
|||||||
extra_context = {
|
extra_context = {
|
||||||
'title': _('Documents checked out'),
|
'title': _('Documents checked out'),
|
||||||
'hide_links': True,
|
'hide_links': True,
|
||||||
'extra_columns': [
|
'extra_columns': (
|
||||||
{
|
{
|
||||||
'name': _('User'),
|
'name': _('User'),
|
||||||
'attribute': encapsulate(
|
'attribute': encapsulate(
|
||||||
@@ -102,7 +102,7 @@ class CheckoutListView(DocumentListView):
|
|||||||
lambda document: document.checkout_info().expiration_datetime
|
lambda document: document.checkout_info().expiration_datetime
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
],
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -132,10 +132,14 @@ def checkout_info(request, document_pk):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
paragraphs.append(
|
paragraphs.append(
|
||||||
_('Check out time: %s') % checkout_info.checkout_datetime
|
_(
|
||||||
|
'Check out time: %s'
|
||||||
|
) % render_date_object(checkout_info.checkout_datetime)
|
||||||
)
|
)
|
||||||
paragraphs.append(
|
paragraphs.append(
|
||||||
_('Check out expiration: %s') % checkout_info.expiration_datetime
|
_(
|
||||||
|
'Check out expiration: %s'
|
||||||
|
) % render_date_object(checkout_info.expiration_datetime)
|
||||||
)
|
)
|
||||||
paragraphs.append(
|
paragraphs.append(
|
||||||
_('New versions allowed: %s') % (_('Yes') if not checkout_info.block_new_version else _('No'))
|
_('New versions allowed: %s') % (_('Yes') if not checkout_info.block_new_version else _('No'))
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import tempfile
|
|||||||
import types
|
import types
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.utils import formats
|
||||||
from django.utils.datastructures import MultiValueDict
|
from django.utils.datastructures import MultiValueDict
|
||||||
|
from django.utils.encoding import force_text
|
||||||
from django.utils.http import urlquote as django_urlquote
|
from django.utils.http import urlquote as django_urlquote
|
||||||
from django.utils.http import urlencode as django_urlencode
|
from django.utils.http import urlencode as django_urlencode
|
||||||
|
|
||||||
@@ -96,6 +98,10 @@ def pretty_size_10(size):
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def render_date_object(date_time_object):
|
||||||
|
return force_text(formats.localize(date_time_object, use_l10n=True))
|
||||||
|
|
||||||
|
|
||||||
def return_attrib(obj, attrib, arguments=None):
|
def return_attrib(obj, attrib, arguments=None):
|
||||||
try:
|
try:
|
||||||
if isinstance(attrib, types.FunctionType):
|
if isinstance(attrib, types.FunctionType):
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ from common.generics import (
|
|||||||
SingleObjectEditView, SingleObjectListView
|
SingleObjectEditView, SingleObjectListView
|
||||||
)
|
)
|
||||||
from common.mixins import MultipleInstanceActionMixin
|
from common.mixins import MultipleInstanceActionMixin
|
||||||
from common.utils import pretty_size
|
from common.utils import pretty_size, render_date_object
|
||||||
from converter.literals import (
|
from converter.literals import (
|
||||||
DEFAULT_PAGE_NUMBER, DEFAULT_ROTATION, DEFAULT_ZOOM_LEVEL
|
DEFAULT_PAGE_NUMBER, DEFAULT_ROTATION, DEFAULT_ZOOM_LEVEL
|
||||||
)
|
)
|
||||||
@@ -268,10 +268,9 @@ def document_properties(request, document_id):
|
|||||||
document.add_as_recent_document_for_user(request.user)
|
document.add_as_recent_document_for_user(request.user)
|
||||||
|
|
||||||
document_fields = [
|
document_fields = [
|
||||||
{'label': _('Date added'), 'field': lambda x: x.date_added.date()},
|
|
||||||
{
|
{
|
||||||
'label': _('Time added'),
|
'label': _('Date added'),
|
||||||
'field': lambda x: unicode(x.date_added.time()).split('.')[0]
|
'field': lambda document: render_date_object(document.date_added)
|
||||||
},
|
},
|
||||||
{'label': _('UUID'), 'field': 'uuid'},
|
{'label': _('UUID'), 'field': 'uuid'},
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user