Added encapsulate factory function to get around Django bug #15791

This commit is contained in:
Roberto Rosario
2011-08-05 09:30:26 -04:00
parent 7b0e177ba2
commit 1b7183be85
15 changed files with 57 additions and 37 deletions
+5 -5
View File
@@ -3,7 +3,7 @@ from django.template import RequestContext
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe
from common.utils import return_type
from common.utils import return_type, encapsulate
from common.widgets import exists_with_famfam
from smart_settings.api import settings
@@ -28,12 +28,12 @@ def setting_list(request):
'hide_link': True,
'hide_object': True,
'extra_columns': [
{'name': _(u'name'), 'attribute': lambda x: mark_safe(u'<span style="font-weight: bold;">%s</span><br>%s' % (x.get('global_name'), x.get('description')))},
{'name': _(u'default'), 'attribute': lambda x: return_type(x['default'])},
{'name': _(u'value'), 'attribute': lambda x: mark_safe(u'<div class="nowrap">%s&nbsp;%s</div>' % (
{'name': _(u'name'), 'attribute': encapsulate(lambda x: mark_safe(u'<span style="font-weight: bold;">%s</span><br>%s' % (x.get('global_name'), x.get('description'))))},
{'name': _(u'default'), 'attribute': encapsulate(lambda x: return_type(x['default']))},
{'name': _(u'value'), 'attribute': encapsulate(lambda x: mark_safe(u'<div class="nowrap">%s&nbsp;%s</div>' % (
return_type(getattr(x['module'], x['name'])),
exists_with_famfam(getattr(x['module'], x['name'])) if x['exists'] else ''
))
)))
},
]
}