-
Notifications
You must be signed in to change notification settings - Fork 2
/
aldryn_config.py
30 lines (21 loc) · 1.2 KB
/
aldryn_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from aldryn_client import forms
class Form(forms.BaseForm):
plugin_module = forms.CharField('Plugin module name', initial='Generic')
plugin_name = forms.CharField('Plugin name', initial='Disqus Comments')
plugin_template = forms.CharField('Plugin Template', required=False)
disqus_public_key = forms.CharField(
'Disqus Public Key',
help_text='register new applications at https://disqus.com/api/applications/register/')
disqus_secret_key = forms.CharField('Disqus Secret Key')
def to_settings(self, data, settings):
settings['DJANGOCMS_DISQUS_PLUGIN_MODULE'] = data['plugin_module']
settings['DJANGOCMS_DISQUS_PLUGIN_NAME'] = data['plugin_name']
plugin_template = data.get('plugin_template', '')
if plugin_template:
settings['DJANGOCMS_DISQUS_PLUGIN_TEMPLATE'] = plugin_template
settings['CONNECTED_ACCOUNTS_DISQUS_CONSUMER_KEY'] = data['disqus_public_key']
settings['CONNECTED_ACCOUNTS_DISQUS_CONSUMER_SECRET'] = data['disqus_secret_key']
settings['MIDDLEWARE_CLASSES'].append('djangocms_disqus.middleware.DisqusMiddleware')
return settings