0006_update_settings.py 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. # Generated by Django 1.10.5 on 2017-02-05 14:34
  2. from django.db import migrations
  3. from ...conf.migrationutils import migrate_settings_group
  4. _ = lambda s: s
  5. def update_users_settings(apps, schema_editor):
  6. migrate_settings_group(
  7. apps,
  8. {
  9. "key": "users",
  10. "name": _("Users"),
  11. "description": _(
  12. "Those settings control user accounts default behaviour and features availability."
  13. ),
  14. "settings": [
  15. {
  16. "setting": "account_activation",
  17. "name": _("New accounts activation"),
  18. "legend": _("New accounts"),
  19. "value": "none",
  20. "form_field": "select",
  21. "field_extra": {
  22. "choices": [
  23. ("none", _("No activation required")),
  24. ("user", _("Activation token sent to User")),
  25. ("admin", _("Activation by administrator")),
  26. ("closed", _("Don't allow new registrations")),
  27. ]
  28. },
  29. "is_public": True,
  30. },
  31. {
  32. "setting": "username_length_min",
  33. "name": _("Minimum length"),
  34. "description": _("Minimum allowed username length."),
  35. "legend": _("User names"),
  36. "python_type": "int",
  37. "default_value": 3,
  38. "field_extra": {"min_value": 2, "max_value": 20},
  39. },
  40. {
  41. "setting": "username_length_max",
  42. "name": _("Maximum length"),
  43. "description": _("Maximum allowed username length."),
  44. "python_type": "int",
  45. "default_value": 14,
  46. "field_extra": {"min_value": 2, "max_value": 20},
  47. },
  48. {
  49. "setting": "allow_custom_avatars",
  50. "name": _("Allow custom avatars"),
  51. "legend": _("Avatars"),
  52. "description": _(
  53. "Turning this option off will forbid "
  54. "forum users from using avatars from "
  55. "outside forums. Good for forums "
  56. "adressed at young users."
  57. ),
  58. "python_type": "bool",
  59. "value": True,
  60. "form_field": "yesno",
  61. },
  62. {
  63. "setting": "default_avatar",
  64. "name": _("Default avatar"),
  65. "value": "gravatar",
  66. "form_field": "select",
  67. "field_extra": {
  68. "choices": [
  69. ("dynamic", _("Individual")),
  70. ("gravatar", _("Gravatar")),
  71. ("gallery", _("Random avatar from gallery")),
  72. ]
  73. },
  74. },
  75. {
  76. "setting": "default_gravatar_fallback",
  77. "name": _("Fallback for default gravatar"),
  78. "description": _(
  79. "Select which avatar to use when user has no "
  80. "gravatar associated with his e-mail address."
  81. ),
  82. "value": "dynamic",
  83. "form_field": "select",
  84. "field_extra": {
  85. "choices": [
  86. ("dynamic", _("Individual")),
  87. ("gallery", _("Random avatar from gallery")),
  88. ]
  89. },
  90. },
  91. {
  92. "setting": "avatar_upload_limit",
  93. "name": _("Maximum size of uploaded avatar"),
  94. "description": _(
  95. "Enter maximum allowed file size (in KB) for avatar uploads."
  96. ),
  97. "python_type": "int",
  98. "default_value": 1536,
  99. "field_extra": {"min_value": 0},
  100. "is_public": True,
  101. },
  102. {
  103. "setting": "signature_length_max",
  104. "name": _("Maximum length"),
  105. "legend": _("Signatures"),
  106. "description": _("Maximum allowed signature length."),
  107. "python_type": "int",
  108. "default_value": 256,
  109. "field_extra": {"min_value": 10, "max_value": 5000},
  110. "is_public": True,
  111. },
  112. {
  113. "setting": "subscribe_start",
  114. "name": _("Started threads"),
  115. "legend": _("Default subscriptions settings"),
  116. "value": "watch_email",
  117. "form_field": "select",
  118. "field_extra": {
  119. "choices": [
  120. ("no", _("Don't watch")),
  121. ("watch", _("Put on watched threads list")),
  122. (
  123. "watch_email",
  124. _(
  125. "Put on watched threads "
  126. "list and e-mail user when "
  127. "somebody replies"
  128. ),
  129. ),
  130. ]
  131. },
  132. },
  133. {
  134. "setting": "subscribe_reply",
  135. "name": _("Replied threads"),
  136. "value": "watch_email",
  137. "form_field": "select",
  138. "field_extra": {
  139. "choices": [
  140. ("no", _("Don't watch")),
  141. ("watch", _("Put on watched threads list")),
  142. (
  143. "watch_email",
  144. _(
  145. "Put on watched threads "
  146. "list and e-mail user when "
  147. "somebody replies"
  148. ),
  149. ),
  150. ]
  151. },
  152. },
  153. ],
  154. },
  155. )
  156. class Migration(migrations.Migration):
  157. dependencies = [("misago_users", "0005_dj_19_update")]
  158. operations = [migrations.RunPython(update_users_settings)]