defaults.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. """
  2. Default settings for the ``mezzanine.generic`` app. Each of these can be
  3. overridden in your project's settings module, just like regular
  4. Django settings. The ``editable`` argument for each controls whether
  5. the setting is editable via Django's admin.
  6. Thought should be given to how a setting is actually used before
  7. making it editable, as it may be inappropriate - for example settings
  8. that are only read during startup shouldn't be editable, since changing
  9. them would require an application reload.
  10. """
  11. from __future__ import unicode_literals
  12. from future.builtins import range
  13. from django.conf import settings
  14. from django.utils.translation import ugettext_lazy as _
  15. from mezzanine.conf import register_setting
  16. generic_comments = getattr(settings, "COMMENTS_APP", "") == "mezzanine.generic"
  17. if generic_comments:
  18. register_setting(
  19. name="COMMENTS_ACCOUNT_REQUIRED",
  20. label=_("Accounts required for commenting"),
  21. description=_("If ``True``, users must log in to comment."),
  22. editable=True,
  23. default=False,
  24. )
  25. register_setting(
  26. name="COMMENTS_DISQUS_SHORTNAME",
  27. label=_("Disqus shortname"),
  28. description=_("Shortname for the http://disqus.com comments "
  29. "service."),
  30. editable=True,
  31. default="",
  32. )
  33. register_setting(
  34. name="COMMENTS_DISQUS_API_PUBLIC_KEY",
  35. label=_("Disqus public key"),
  36. description=_("Public key for http://disqus.com developer API"),
  37. editable=True,
  38. default="",
  39. )
  40. register_setting(
  41. name="COMMENTS_DISQUS_API_SECRET_KEY",
  42. label=_("Disqus secret key"),
  43. description=_("Secret key for http://disqus.com developer API"),
  44. editable=True,
  45. default="",
  46. )
  47. register_setting(
  48. name="COMMENTS_DEFAULT_APPROVED",
  49. label=_("Auto-approve comments"),
  50. description=_("If ``True``, built-in comments are approved by "
  51. "default."),
  52. editable=True,
  53. default=True,
  54. )
  55. register_setting(
  56. name="COMMENT_FILTER",
  57. description=_("Dotted path to the function to call on a comment's "
  58. "value before it is rendered to the template."),
  59. editable=False,
  60. default=None,
  61. )
  62. register_setting(
  63. name="COMMENTS_NOTIFICATION_EMAILS",
  64. label=_("Comment notification email addresses"),
  65. description=_("A comma separated list of email addresses that "
  66. "will receive an email notification each time a "
  67. "new comment is posted on the site."),
  68. editable=True,
  69. default="",
  70. )
  71. register_setting(
  72. name="COMMENTS_NUM_LATEST",
  73. label=_("Admin comments"),
  74. description=_("Number of latest comments shown in the admin "
  75. "dashboard."),
  76. editable=True,
  77. default=5,
  78. )
  79. register_setting(
  80. name="COMMENTS_UNAPPROVED_VISIBLE",
  81. label=_("Show unapproved comments"),
  82. description=_("If ``True``, comments that have ``is_public`` "
  83. "unchecked will still be displayed, but replaced with a "
  84. "``waiting to be approved`` message."),
  85. editable=True,
  86. default=True,
  87. )
  88. register_setting(
  89. name="COMMENTS_REMOVED_VISIBLE",
  90. label=_("Show removed comments"),
  91. description=_("If ``True``, comments that have ``removed`` "
  92. "checked will still be displayed, but replaced "
  93. "with a ``removed`` message."),
  94. editable=True,
  95. default=True,
  96. )
  97. register_setting(
  98. name="COMMENTS_USE_RATINGS",
  99. description=_("If ``True``, comments can be rated."),
  100. editable=False,
  101. default=True,
  102. )
  103. register_setting(
  104. name="COMMENT_FORM_CLASS",
  105. description=_("The form class to use for adding new comments."),
  106. editable=False,
  107. default="mezzanine.generic.forms.ThreadedCommentForm",
  108. )
  109. register_setting(
  110. name="RATINGS_ACCOUNT_REQUIRED",
  111. label=_("Accounts required for rating"),
  112. description=_("If ``True``, users must log in to rate content "
  113. "such as blog posts and comments."),
  114. editable=True,
  115. default=False,
  116. )
  117. register_setting(
  118. name="RATINGS_RANGE",
  119. description=_("A sequence of integers that are valid ratings."),
  120. editable=False,
  121. default=list(range(getattr(settings, "RATINGS_MIN", 1),
  122. getattr(settings, "RATINGS_MAX", 5) + 1)),
  123. )