0006_update_settings.py 6.1 KB

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