0002_threads_settings.py 2.7 KB

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