0002_basic_settings.py 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from django.db import models, migrations
  4. from django.utils.translation import ugettext as _
  5. from misago.conf.migrationutils import migrate_settings_group
  6. def create_basic_settings_group(apps, schema_editor):
  7. migrate_settings_group(
  8. apps,
  9. {
  10. 'key': 'basic',
  11. 'name': _("Basic forum settings"),
  12. 'description': _("Those settings control most basic properties "
  13. "of your forum like its name or description."),
  14. 'settings': (
  15. {
  16. 'setting': 'forum_name',
  17. 'name': _("Forum name"),
  18. 'legend': _("General"),
  19. 'value': "Misago",
  20. 'field_extra': {
  21. 'min_length': 2,
  22. 'max_length': 255
  23. },
  24. 'is_public': True,
  25. },
  26. {
  27. 'setting': 'forum_index_title',
  28. 'name': _("Index title"),
  29. 'description': _("You may set custon title on "
  30. "forum index by typing it here."),
  31. 'legend': _("Forum index"),
  32. 'field_extra': {
  33. 'max_length': 255
  34. },
  35. 'is_public': True,
  36. },
  37. {
  38. 'setting': 'forum_index_meta_description',
  39. 'name': _("Meta Description"),
  40. 'description': _("Short description of your forum "
  41. "for internet crawlers."),
  42. 'field_extra': {
  43. 'max_length': 255
  44. },
  45. },
  46. {
  47. 'setting': 'email_footer',
  48. 'name': _("E-mails footer"),
  49. 'description': _("Optional short message included "
  50. "at the end of e-mails sent by "
  51. "forum"),
  52. 'legend': _("Forum e-mails"),
  53. 'field_extra': {
  54. 'max_length': 255
  55. },
  56. },
  57. )
  58. })
  59. migrate_settings_group(
  60. apps,
  61. {
  62. 'key': 'captcha',
  63. 'name': _("CAPTCHA"),
  64. 'description': _("Those settings allow you to combat automatic "
  65. "registrations and spam messages on your forum."),
  66. 'settings': (
  67. {
  68. 'setting': 'captcha_on_registration',
  69. 'name': _("CAPTCHA on registration"),
  70. 'legend': _("CAPTCHA types"),
  71. 'value': 'no',
  72. 'form_field': 'select',
  73. 'field_extra': {
  74. 'choices': (
  75. ('no', _("No protection")),
  76. ('recaptcha', _("reCaptcha")),
  77. ('qa', _("Question and answer")),
  78. ),
  79. },
  80. },
  81. {
  82. 'setting': 'recaptcha_public_api_key',
  83. 'name': _("Public API key"),
  84. 'legend': _("reCAPTCHA"),
  85. 'value': '',
  86. 'field_extra': {
  87. 'required': False,
  88. 'max_length': 100,
  89. },
  90. },
  91. {
  92. 'setting': 'recaptcha_private_api_key',
  93. 'name': _("Private API key"),
  94. 'value': '',
  95. 'field_extra': {
  96. 'required': False,
  97. 'max_length': 100,
  98. },
  99. },
  100. {
  101. 'setting': 'qa_question',
  102. 'name': _("Test question"),
  103. 'legend': _("Question and answer"),
  104. 'value': '',
  105. 'field_extra': {
  106. 'required': False,
  107. 'max_length': 250,
  108. },
  109. },
  110. {
  111. 'setting': 'qa_help_text',
  112. 'name': _("Question help text"),
  113. 'value': '',
  114. 'field_extra': {
  115. 'required': False,
  116. 'max_length': 250,
  117. },
  118. },
  119. {
  120. 'setting': 'qa_answers',
  121. 'name': _("Valid answers"),
  122. 'description': _("Enter each answer in new line. "
  123. "Answers are case-insensitive."),
  124. 'value': '',
  125. 'form_field': 'textarea',
  126. 'field_extra': {
  127. 'rows': 4,
  128. 'required': False,
  129. 'max_length': 250,
  130. },
  131. },
  132. )
  133. })
  134. class Migration(migrations.Migration):
  135. dependencies = [
  136. ('misago_core', '0001_initial'),
  137. ('misago_conf', '0001_initial'),
  138. ]
  139. operations = [
  140. migrations.RunPython(create_basic_settings_group),
  141. ]