/django_summernote/settings.py
https://github.com/nidico/django-summernote · Python · 81 lines · 73 code · 8 blank · 0 comment · 0 complexity · 0c65b92a38eed096e9cf93a36a918d84 MD5 · raw file
- import os
- import uuid
- from datetime import datetime
- from django.conf import settings
- def uploaded_filepath(instance, filename):
- ext = filename.split('.')[-1]
- filename = "%s.%s" % (uuid.uuid4(), ext)
- today = datetime.now().strftime('%Y-%m-%d')
- return os.path.join('django-summernote', today, filename)
- SETTINGS_USER = getattr(settings, 'SUMMERNOTE_CONFIG', {})
- SETTINGS_DEFAULT = {
- 'iframe': True,
- 'airMode': False,
- 'empty': ('<p><br/></p>', '<p><br></p>'),
- 'width': 720,
- 'height': 480,
- 'toolbar': [
- ['style', ['style']],
- ['font', ['bold', 'italic', 'underline', 'superscript', 'subscript',
- 'strikethrough', 'clear']],
- ['fontname', ['fontname']],
- ['fontsize', ['fontsize']],
- ['color', ['color']],
- ['para', ['ul', 'ol', 'paragraph']],
- ['height', ['height']],
- ['table', ['table']],
- ['insert', ['link', 'picture', 'video', 'hr']],
- ['view', ['fullscreen', 'codeview']],
- ['help', ['help']],
- ],
- 'lang': None,
- 'lang_matches': {
- 'ar': 'ar-AR',
- 'ca': 'ca-ES',
- 'cs': 'cs-CZ',
- 'da': 'da-DK',
- 'de': 'de-DE',
- 'es': 'es-ES',
- 'fa': 'fa-IR',
- 'fr': 'fr-FR',
- 'hu': 'hu-HU',
- 'id': 'id-ID',
- 'it': 'it-IT',
- 'ja': 'ja-JP',
- 'ko': 'ko-KR',
- 'nb': 'nb-NO',
- 'nl': 'nl-NL',
- 'pl': 'pl-PL',
- 'pt': 'pt-BR',
- 'ro': 'ro-RO',
- 'ru': 'ru-RU',
- 'sr': 'sr-RS',
- 'sv': 'sv-SE',
- 'tr': 'tr-TR',
- 'uk': 'uk-UA',
- 'vi': 'vi-VN',
- 'zh': 'zh-CN',
- 'zh': 'zh-TW',
- },
- 'attachment_upload_to': uploaded_filepath,
- 'attachment_storage_class': None,
- 'attachment_filesize_limit': 1024 * 1024,
- 'inplacewidget_external_css': (
- '//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css',
- '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css',
- ),
- 'inplacewidget_external_js': (
- '//code.jquery.com/jquery-1.9.1.min.js',
- '//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js',
- ),
- }
- summernote_config = SETTINGS_DEFAULT.copy()
- summernote_config.update(SETTINGS_USER)