Add from __future__ import unicode_literals, issue #37
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from project_setup.api import register_setup
|
||||
|
||||
from .links import check_settings
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings as django_settings
|
||||
from django.utils.importlib import import_module
|
||||
|
||||
settings = {}
|
||||
|
||||
|
||||
def register_setting(namespace, module, name, global_name, default, exists=False, description=u'', hidden=False):
|
||||
def register_setting(namespace, module, name, global_name, default, exists=False, description='', hidden=False):
|
||||
# Create namespace if it doesn't exists
|
||||
settings.setdefault(namespace, [])
|
||||
|
||||
@@ -43,6 +45,6 @@ def register_settings(namespace, module, settings):
|
||||
setting['global_name'],
|
||||
setting['default'],
|
||||
setting.get('exists', False),
|
||||
setting.get('description', u''),
|
||||
setting.get('description', ''),
|
||||
setting.get('hidden', False),
|
||||
)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
@@ -5,4 +7,4 @@ def is_superuser(context):
|
||||
return context['request'].user.is_staff or context['request'].user.is_superuser
|
||||
|
||||
|
||||
check_settings = {'text': _(u'Settings'), 'view': 'settings:setting_list', 'famfam': 'cog', 'icon': 'cog.png', 'condition': is_superuser}
|
||||
check_settings = {'text': _('Settings'), 'view': 'settings:setting_list', 'famfam': 'cog', 'icon': 'cog.png', 'condition': is_superuser}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf.urls import patterns, url
|
||||
|
||||
urlpatterns = patterns('smart_settings.views',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.shortcuts import render_to_response
|
||||
from django.template import RequestContext
|
||||
@@ -26,14 +26,14 @@ def setting_list(request):
|
||||
})
|
||||
|
||||
context = {
|
||||
'title': _(u'Settings'),
|
||||
'title': _('Settings'),
|
||||
'object_list': sorted(new_settings, key=lambda entry: entry['global_name']),
|
||||
'hide_link': True,
|
||||
'hide_object': True,
|
||||
'extra_columns': [
|
||||
{'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': _('Name'), 'attribute': encapsulate(lambda x: mark_safe('<span style="font-weight: bold;">%s</span><br />%s' % (x.get('global_name'), x.get('description'))))},
|
||||
{
|
||||
'name': _(u'Value'), 'attribute': encapsulate(lambda x: mark_safe(u'<div class="nowrap">%s %s</div>' % (
|
||||
'name': _('Value'), 'attribute': encapsulate(lambda x: mark_safe('<div class="nowrap">%s %s</div>' % (
|
||||
return_type(getattr(x['module'], x['name'])),
|
||||
exists_with_famfam(getattr(x['module'], x['name'])) if x['exists'] else ''
|
||||
)))
|
||||
|
||||
Reference in New Issue
Block a user