Improve date rendering.
This commit is contained in:
@@ -87,22 +87,22 @@
|
||||
{% endif %}
|
||||
{% if not hide_columns %}
|
||||
{% for column in object|get_source_columns %}
|
||||
<td>{% source_column_resolve column=column %}</td>
|
||||
<td>{% source_column_resolve column=column %}{{ column_result }}</td>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% for column in extra_columns %}
|
||||
<td>{{ object|object_property:column.attribute }}</td>
|
||||
{% endfor %}
|
||||
{% if not hide_links %}
|
||||
<td class="last">
|
||||
{% get_menu_links 'object menu' source=object as resolved_links %}
|
||||
{% for object_navigation_links in resolved_links %}
|
||||
{% with 'true' as horizontal %}
|
||||
{% include 'navigation/generic_navigation.html' %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% for column in extra_columns %}
|
||||
<td>{{ object|object_property:column.attribute }}</td>
|
||||
{% endfor %}
|
||||
{% if not hide_links %}
|
||||
<td class="last">
|
||||
{% get_menu_links 'object menu' source=object as resolved_links %}
|
||||
{% for object_navigation_links in resolved_links %}
|
||||
{% with 'true' as horizontal %}
|
||||
{% include 'navigation/generic_navigation.html' %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td class="text-center" colspan=99>{% trans 'No results' %}</td></tr>
|
||||
|
||||
@@ -15,6 +15,7 @@ from django.utils.http import urlencode, urlquote
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from acls.models import AccessControlList
|
||||
from common.utils import return_attrib
|
||||
from permissions import Permission
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -289,6 +290,14 @@ class SourceColumn(object):
|
||||
self.__class__._registry.setdefault(source, [])
|
||||
self.__class__._registry[source].append(self)
|
||||
|
||||
def resolve(self, context):
|
||||
if self.attribute:
|
||||
result = return_attrib(context['object'], self.attribute)
|
||||
elif self.func:
|
||||
result = self.func(context=context)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
class CombinedSource(object):
|
||||
"""
|
||||
|
||||
@@ -64,7 +64,5 @@ def get_source_columns(source):
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def source_column_resolve(context, column):
|
||||
if column.attribute:
|
||||
return return_attrib(context['object'], column.attribute)
|
||||
elif column.func:
|
||||
return column.func(context=context)
|
||||
context['column_result'] = column.resolve(context=context)
|
||||
return ''
|
||||
|
||||
Reference in New Issue
Block a user