0002_threads_settings.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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': 'threads',
  10. 'name': _("Threads"),
  11. 'description': _("Those settings control threads and posts."),
  12. 'settings': [
  13. {
  14. 'setting': 'thread_title_length_min',
  15. 'name': _("Minimum length"),
  16. 'description': _("Minimum allowed thread title length."),
  17. 'legend': _("Thread titles"),
  18. 'python_type': 'int',
  19. 'value': 5,
  20. 'field_extra': {
  21. 'min_value': 2,
  22. 'max_value': 255,
  23. },
  24. 'is_public': True,
  25. },
  26. {
  27. 'setting': 'thread_title_length_max',
  28. 'name': _("Maximum length"),
  29. 'description': _("Maximum allowed thread length."),
  30. 'python_type': 'int',
  31. 'value': 90,
  32. 'field_extra': {
  33. 'min_value': 2,
  34. 'max_value': 255,
  35. },
  36. 'is_public': True,
  37. },
  38. {
  39. 'setting': 'post_length_min',
  40. 'name': _("Minimum length"),
  41. 'description': _("Minimum allowed user post length."),
  42. 'legend': _("Posts"),
  43. 'python_type': 'int',
  44. 'value': 5,
  45. 'field_extra': {
  46. 'min_value': 1,
  47. },
  48. 'is_public': True,
  49. },
  50. {
  51. 'setting': 'post_length_max',
  52. 'name': _("Maximum length"),
  53. 'description': _(
  54. "Maximum allowed user post length. Enter zero to disable. "
  55. "Longer posts are more costful to parse and index."
  56. ),
  57. 'python_type': 'int',
  58. 'value': 60000,
  59. 'field_extra': {
  60. 'min_value': 0,
  61. },
  62. 'is_public': True,
  63. },
  64. ],
  65. }
  66. )
  67. class Migration(migrations.Migration):
  68. dependencies = [
  69. ('misago_threads', '0001_initial'),
  70. ('misago_conf', '0001_initial'),
  71. ]
  72. operations = [
  73. migrations.RunPython(create_threads_settings_group),
  74. ]