0002_threads_settings.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. {
  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": {"min_value": 2, "max_value": 255},
  20. "is_public": True,
  21. },
  22. {
  23. "setting": "thread_title_length_max",
  24. "name": _("Maximum length"),
  25. "description": _("Maximum allowed thread length."),
  26. "python_type": "int",
  27. "value": 90,
  28. "field_extra": {"min_value": 2, "max_value": 255},
  29. "is_public": True,
  30. },
  31. {
  32. "setting": "post_length_min",
  33. "name": _("Minimum length"),
  34. "description": _("Minimum allowed user post length."),
  35. "legend": _("Posts"),
  36. "python_type": "int",
  37. "value": 5,
  38. "field_extra": {"min_value": 1},
  39. "is_public": True,
  40. },
  41. {
  42. "setting": "post_length_max",
  43. "name": _("Maximum length"),
  44. "description": _(
  45. "Maximum allowed user post length. Enter zero to disable. "
  46. "Longer posts are more costful to parse and index."
  47. ),
  48. "python_type": "int",
  49. "value": 60000,
  50. "field_extra": {"min_value": 0},
  51. "is_public": True,
  52. },
  53. ],
  54. },
  55. )
  56. class Migration(migrations.Migration):
  57. dependencies = [("misago_threads", "0001_initial"), ("misago_conf", "0001_initial")]
  58. operations = [migrations.RunPython(create_threads_settings_group)]