0002_threads_settings.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from django.db import migrations
  4. from misago.conf.migrationutils import migrate_settings_group
  5. _ = lambda x: x
  6. def create_threads_settings_group(apps, schema_editor):
  7. migrate_settings_group(
  8. apps, {
  9. 'key':
  10. 'threads',
  11. 'name':
  12. _("Threads"),
  13. 'description':
  14. _("Those settings control threads and posts."),
  15. 'settings': [
  16. {
  17. 'setting': 'thread_title_length_min',
  18. 'name': _("Minimum length"),
  19. 'description': _("Minimum allowed thread title length."),
  20. 'legend': _("Thread titles"),
  21. 'python_type': 'int',
  22. 'value': 5,
  23. 'field_extra': {
  24. 'min_value': 2,
  25. 'max_value': 255,
  26. },
  27. 'is_public': True,
  28. },
  29. {
  30. 'setting': 'thread_title_length_max',
  31. 'name': _("Maximum length"),
  32. 'description': _("Maximum allowed thread length."),
  33. 'python_type': 'int',
  34. 'value': 90,
  35. 'field_extra': {
  36. 'min_value': 2,
  37. 'max_value': 255,
  38. },
  39. 'is_public': True,
  40. },
  41. {
  42. 'setting': 'post_length_min',
  43. 'name': _("Minimum length"),
  44. 'description': _("Minimum allowed user post length."),
  45. 'legend': _("Posts"),
  46. 'python_type': 'int',
  47. 'value': 5,
  48. 'field_extra': {
  49. 'min_value': 1,
  50. },
  51. 'is_public': True,
  52. },
  53. {
  54. 'setting':
  55. 'post_length_max',
  56. 'name':
  57. _("Maximum length"),
  58. 'description':
  59. _(
  60. "Maximum allowed user post length. Enter zero to disable. "
  61. "Longer posts are more costful to parse and index."
  62. ),
  63. 'python_type':
  64. 'int',
  65. 'value':
  66. 60000,
  67. 'field_extra': {
  68. 'min_value': 0,
  69. },
  70. 'is_public':
  71. True,
  72. },
  73. ],
  74. }
  75. )
  76. class Migration(migrations.Migration):
  77. dependencies = [
  78. ('misago_threads', '0001_initial'),
  79. ('misago_conf', '0001_initial'),
  80. ]
  81. operations = [
  82. migrations.RunPython(create_threads_settings_group),
  83. ]