PageRenderTime 29ms CodeModel.GetById 23ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/feincms/default_settings.py

http://github.com/feincms/feincms
Python | 147 lines | 133 code | 3 blank | 11 comment | 0 complexity | e5f9b2792e6b08566467e139c2dcb84c MD5 | raw file
  1# ------------------------------------------------------------------------
  2# coding=utf-8
  3# ------------------------------------------------------------------------
  4"""
  5Default settings for FeinCMS
  6
  7All of these can be overridden by specifying them in the standard
  8``settings.py`` file.
  9"""
 10
 11from __future__ import absolute_import, unicode_literals
 12
 13from django.conf import settings
 14
 15# e.g. 'uploads' if you would prefer <media root>/uploads/imagecontent/test.jpg
 16# to <media root>/imagecontent/test.jpg.
 17FEINCMS_UPLOAD_PREFIX = getattr(settings, "FEINCMS_UPLOAD_PREFIX", "")
 18
 19# ------------------------------------------------------------------------
 20# Settings for MediaLibrary
 21
 22#: Local path to newly uploaded media files
 23FEINCMS_MEDIALIBRARY_UPLOAD_TO = getattr(
 24    settings, "FEINCMS_MEDIALIBRARY_UPLOAD_TO", "medialibrary/%Y/%m/"
 25)
 26
 27#: Thumbnail function for suitable mediafiles. Only receives the media file
 28#: and should return a thumbnail URL (or nothing).
 29FEINCMS_MEDIALIBRARY_THUMBNAIL = getattr(
 30    settings,
 31    "FEINCMS_MEDIALIBRARY_THUMBNAIL",
 32    "feincms.module.medialibrary.thumbnail.default_admin_thumbnail",
 33)
 34
 35# ------------------------------------------------------------------------
 36# Settings for RichText
 37
 38FEINCMS_RICHTEXT_INIT_TEMPLATE = getattr(
 39    settings,
 40    "FEINCMS_RICHTEXT_INIT_TEMPLATE",
 41    "admin/content/richtext/init_tinymce4.html",
 42)
 43FEINCMS_RICHTEXT_INIT_CONTEXT = getattr(
 44    settings,
 45    "FEINCMS_RICHTEXT_INIT_CONTEXT",
 46    {
 47        "TINYMCE_JS_URL": "//tinymce.cachefly.net/4.2/tinymce.min.js",
 48        "TINYMCE_DOMAIN": None,
 49        "TINYMCE_CONTENT_CSS_URL": None,
 50        "TINYMCE_LINK_LIST_URL": None,
 51    },
 52)
 53
 54# ------------------------------------------------------------------------
 55# Settings for the page module
 56
 57#: Include ancestors in filtered tree editor lists
 58FEINCMS_TREE_EDITOR_INCLUDE_ANCESTORS = getattr(
 59    settings, "FEINCMS_TREE_EDITOR_INCLUDE_ANCESTORS", False
 60)
 61
 62#: Enable checking of object level permissions. Note that if this option is
 63#: enabled, you must plug in an authentication backend that actually does
 64#: implement object level permissions or no page will be editable.
 65FEINCMS_TREE_EDITOR_OBJECT_PERMISSIONS = getattr(
 66    settings, "FEINCMS_TREE_EDITOR_OBJECT_PERMISSIONS", False
 67)
 68
 69#: When enabled, the page module is automatically registered with Django's
 70#: default admin site (this is activated by default).
 71FEINCMS_USE_PAGE_ADMIN = getattr(settings, "FEINCMS_USE_PAGE_ADMIN", True)
 72
 73#: app_label.model_name as per apps.get_model.
 74#: defaults to page.Page
 75FEINCMS_DEFAULT_PAGE_MODEL = getattr(
 76    settings, "FEINCMS_DEFAULT_PAGE_MODEL", "page.Page"
 77)
 78
 79# ------------------------------------------------------------------------
 80#: Allow random gunk after a valid page?
 81FEINCMS_ALLOW_EXTRA_PATH = getattr(settings, "FEINCMS_ALLOW_EXTRA_PATH", False)
 82
 83# ------------------------------------------------------------------------
 84#: How to switch languages.
 85#: * ``'STANDARD'``: The page a user navigates to sets the site's language
 86#:   and overwrites whatever was set before.
 87#: * ``'EXPLICIT'``: The language set has priority, may only be overridden
 88#:   by explicitely a language with ``?set_language=xx``.
 89FEINCMS_TRANSLATION_POLICY = getattr(settings, "FEINCMS_TRANSLATION_POLICY", "STANDARD")
 90
 91# ------------------------------------------------------------------------
 92#: Makes the page handling mechanism try to find a cms page with that
 93#: path if it encounters a page not found situation. This allows for nice
 94#: customised cms-styled error pages. Do not go overboard, this should
 95#: be as simple and as error resistant as possible, so refrain from
 96#: deeply nested error pages or advanced content types.
 97FEINCMS_CMS_404_PAGE = getattr(settings, "FEINCMS_CMS_404_PAGE", None)
 98
 99# ------------------------------------------------------------------------
100#: When uploading files to the media library, replacing an existing entry,
101#: try to save the new file under the old file name in order to keep the
102#: media file path (and thus the media url) constant.
103#: Experimental, this might not work with all storage backends.
104FEINCMS_MEDIAFILE_OVERWRITE = getattr(settings, "FEINCMS_MEDIAFILE_OVERWRITE", False)
105
106# ------------------------------------------------------------------------
107#: Prefix for thumbnails. Set this to something non-empty to separate thumbs
108#: from uploads. The value should end with a slash, but this is not enforced.
109FEINCMS_THUMBNAIL_DIR = getattr(settings, "FEINCMS_THUMBNAIL_DIR", "_thumbs/")
110
111# ------------------------------------------------------------------------
112#: feincms_thumbnail template filter library cache timeout. The default is to
113#: not cache anything for backwards compatibility.
114FEINCMS_THUMBNAIL_CACHE_TIMEOUT = getattr(
115    settings, "FEINCMS_THUMBNAIL_CACHE_TIMEOUT", 0
116)
117
118# ------------------------------------------------------------------------
119#: Prevent changing template within admin for pages which have been
120#: allocated a Template with singleton=True -- template field will become
121#: read-only for singleton pages.
122FEINCMS_SINGLETON_TEMPLATE_CHANGE_ALLOWED = getattr(
123    settings, "FEINCMS_SINGLETON_TEMPLATE_CHANGE_ALLOWED", False
124)
125
126#: Prevent admin page deletion for pages which have been allocated a
127#: Template with singleton=True
128FEINCMS_SINGLETON_TEMPLATE_DELETION_ALLOWED = getattr(
129    settings, "FEINCMS_SINGLETON_TEMPLATE_DELETION_ALLOWED", False
130)
131
132# ------------------------------------------------------------------------
133#: Filter languages available for front end users to this set. This allows
134#: to have languages not yet ready for prime time while being able to access
135#: those pages in the admin backend.
136FEINCMS_FRONTEND_LANGUAGES = getattr(settings, "FEINCMS_FRONTEND_LANGUAGES", None)
137
138# ------------------------------------------------------------------------
139
140# ------------------------------------------------------------------------
141#: Attempt to get translations of MediaFile objects. If `False`, FeinCMS will
142#: instead just output the file name.
143FEINCMS_MEDIAFILE_TRANSLATIONS = getattr(
144    settings, "FEINCMS_MEDIAFILE_TRANSLATIONS", True
145)
146
147# ------------------------------------------------------------------------