0002_threads_settings.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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(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. 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. ]