0006_update_settings.py 6.7 KB

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