0002_threads_settings.py 2.6 KB

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