0002_threads_settings.py 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from django.conf import settings
  4. from django.db import migrations, models
  5. from misago.conf.migrationutils import migrate_settings_group
  6. _ = lambda x: x
  7. def create_threads_settings_group(apps, schema_editor):
  8. migrate_settings_group(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': _("Maximum allowed user post length. Enter zero to disable"),
  54. 'python_type': 'int',
  55. 'value': 60000,
  56. 'field_extra': {
  57. 'min_value': 0,
  58. },
  59. 'is_public': True,
  60. },
  61. )
  62. })
  63. class Migration(migrations.Migration):
  64. dependencies = [
  65. ('misago_threads', '0001_initial'),
  66. ('misago_conf', '0001_initial'),
  67. ]
  68. operations = [
  69. migrations.RunPython(create_threads_settings_group),
  70. ]