0002_basic_settings.py 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. },
  25. {
  26. 'setting': 'forum_index_title',
  27. 'name': _("Index title"),
  28. 'description': _("You may set custon title on "
  29. "forum index by typing it here."),
  30. 'legend': _("Forum index"),
  31. 'field_extra': {
  32. 'max_length': 255
  33. },
  34. },
  35. {
  36. 'setting': 'forum_index_meta_description',
  37. 'name': _("Meta Description"),
  38. 'description': _("Short description of your forum "
  39. "for internet crawlers."),
  40. 'field_extra': {
  41. 'max_length': 255
  42. },
  43. },
  44. {
  45. 'setting': 'email_footer',
  46. 'name': _("E-mails footer"),
  47. 'description': _("Optional short message included "
  48. "at the end of e-mails sent by "
  49. "forum"),
  50. 'legend': _("Forum e-mails"),
  51. 'field_extra': {
  52. 'max_length': 255
  53. },
  54. },
  55. )
  56. })
  57. migrate_settings_group(
  58. apps,
  59. {
  60. 'key': 'captcha',
  61. 'name': _("CAPTCHA"),
  62. 'description': _("Those settings allow you to combat automatic "
  63. "registrations and spam messages on your forum."),
  64. 'settings': (
  65. {
  66. 'setting': 'captcha_on_registration',
  67. 'name': _("CAPTCHA on registration"),
  68. 'legend': _("CAPTCHA types"),
  69. 'value': 'no',
  70. 'form_field': 'select',
  71. 'field_extra': {
  72. 'choices': (
  73. ('no', _("No protection")),
  74. ('recaptcha', _("reCaptcha")),
  75. ('qa', _("Question and answer")),
  76. ),
  77. },
  78. },
  79. {
  80. 'setting': 'recaptcha_public_api_key',
  81. 'name': _("Public API key"),
  82. 'legend': _("reCAPTCHA"),
  83. 'value': '',
  84. 'field_extra': {
  85. 'required': False,
  86. 'max_length': 100,
  87. },
  88. },
  89. {
  90. 'setting': 'recaptcha_private_api_key',
  91. 'name': _("Private API key"),
  92. 'value': '',
  93. 'field_extra': {
  94. 'required': False,
  95. 'max_length': 100,
  96. },
  97. },
  98. {
  99. 'setting': 'qa_question',
  100. 'name': _("Test question"),
  101. 'legend': _("Question and answer"),
  102. 'value': '',
  103. 'field_extra': {
  104. 'required': False,
  105. 'max_length': 250,
  106. },
  107. },
  108. {
  109. 'setting': 'qa_help_text',
  110. 'name': _("Question help text"),
  111. 'value': '',
  112. 'field_extra': {
  113. 'required': False,
  114. 'max_length': 250,
  115. },
  116. },
  117. {
  118. 'setting': 'qa_answers',
  119. 'name': _("Valid answers"),
  120. 'description': _("Enter each answer in new line. "
  121. "Answers are case-insensitive."),
  122. 'value': '',
  123. 'form_field': 'textarea',
  124. 'field_extra': {
  125. 'rows': 4,
  126. 'required': False,
  127. 'max_length': 250,
  128. },
  129. },
  130. )
  131. })
  132. class Migration(migrations.Migration):
  133. dependencies = [
  134. ('misago_core', '0001_initial'),
  135. ('misago_conf', '0001_initial'),
  136. ]
  137. operations = [
  138. migrations.RunPython(create_basic_settings_group),
  139. ]