install djangocms-link 2.1.2

This commit is contained in:
2018-03-15 11:21:27 +00:00
parent 3669cb5cb3
commit 95e33b7dc2
5 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
{
"installed-apps": [
"djangocms_link"
],
"package-name": "djangocms-link"
}

View File

@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
from aldryn_client import forms
def split_and_strip(string):
return [item.strip() for item in string.split(',') if item]
class Form(forms.BaseForm):
templates = forms.CharField(
'List of additional templates (comma separated)',
required=False,
)
"""
The following settings need to be configured on your project separately
as we don't want to expose them as aldryn configurations yet:
DJANGOCMS_LINK_INTRANET_HOSTNAME_PATTERN
DJANGOCMS_LINK_USE_SELECT2
"""
def clean(self):
data = super(Form, self).clean()
# prettify
data['templates'] = ', '.join(split_and_strip(data['templates']))
return data
def to_settings(self, data, settings):
if data['templates']:
settings['DJANGOCMS_LINK_TEMPLATES'] = [
(item, item)
for item in split_and_strip(data['templates'])
]
return settings

View File

@@ -0,0 +1,3 @@
{
"templates": null
}