/feincms/default_settings.py

http://github.com/feincms/feincms · Python · 147 lines · 54 code · 25 blank · 68 comment · 0 complexity · e5f9b2792e6b08566467e139c2dcb84c MD5 · raw file

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