Add support for CUSTOM_LOGO and CUSTOM_LOGIN_INFO settings, add support to migrate from local_settings.json and custom_console_logo.png.

This commit is contained in:
Chris Church
2016-11-21 15:33:07 -05:00
parent 06510ce4b9
commit a35ed0a09d
5 changed files with 227 additions and 11 deletions

View File

@@ -5,16 +5,8 @@
from django.utils.translation import ugettext_lazy as _
# Tower
from awx.conf import fields, register
class PendoTrackingStateField(fields.ChoiceField):
def to_internal_value(self, data):
# Any false/null values get converted to 'off'.
if data in fields.NullBooleanField.FALSE_VALUES or data in fields.NullBooleanField.NULL_VALUES:
return 'off'
return super(PendoTrackingStateField, self).to_internal_value(data)
from awx.conf import register, fields
from awx.ui.fields import * # noqa
register(
@@ -30,3 +22,35 @@ register(
category=_('UI'),
category_slug='ui',
)
register(
'CUSTOM_LOGIN_INFO',
field_class=fields.CharField,
allow_blank=True,
default='',
label=_('Custom Login Info'),
help_text=_('If needed, you can add specific information (such as a legal '
'notice or a disclaimer) to a text box in the login modal using '
'this setting. Any content added must be in plain text, as '
'custom HTML or other markup languages are not supported. If '
'multiple paragraphs of text are needed, new lines (paragraphs) '
'must be escaped as `\\n` within the block of text.'),
category=_('UI'),
category_slug='ui',
feature_required='rebranding',
)
register(
'CUSTOM_LOGO',
field_class=CustomLogoField,
allow_blank=True,
default='',
label=_('Custom Logo'),
help_text=_('To set up a custom logo, provide a file that you create. For '
'the custom logo to look its best, use a `.png` file with a '
'transparent background. GIF, PNG and JPEG formats are supported.'),
placeholder='data:image/gif;base64,R0lGODlhAQABAAAAADs=',
category=_('UI'),
category_slug='ui',
feature_required='rebranding',
)