0002_threads_settings.py 2.6 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 django.utils.translation import ugettext as _
  6. from misago.conf.migrationutils import migrate_settings_group
  7. def create_threads_settings_group(apps, schema_editor):
  8. migrate_settings_group(
  9. apps,
  10. {
  11. 'key': 'threads',
  12. 'name': _("Threads"),
  13. 'description': _("Those settings control threads and posts."),
  14. 'settings': (
  15. {
  16. 'setting': 'thread_title_length_min',
  17. 'name': _("Minimum length"),
  18. 'description': _("Minimum allowed thread title length."),
  19. 'legend': _("Thread titles"),
  20. 'python_type': 'int',
  21. 'value': 5,
  22. 'field_extra': {
  23. 'min_value': 2,
  24. 'max_value': 255,
  25. },
  26. 'is_public': True,
  27. },
  28. {
  29. 'setting': 'thread_title_length_max',
  30. 'name': _("Maximum length"),
  31. 'description': _("Maximum allowed thread length."),
  32. 'python_type': 'int',
  33. 'value': 90,
  34. 'field_extra': {
  35. 'min_value': 2,
  36. 'max_value': 255,
  37. },
  38. 'is_public': True,
  39. },
  40. {
  41. 'setting': 'post_length_min',
  42. 'name': _("Minimum length"),
  43. 'description': _("Minimum allowed user post length."),
  44. 'legend': _("Posts"),
  45. 'python_type': 'int',
  46. 'value': 5,
  47. 'field_extra': {
  48. 'min_value': 1,
  49. },
  50. 'is_public': True,
  51. },
  52. {
  53. 'setting': 'post_length_max',
  54. 'name': _("Maximum length"),
  55. 'description': _("Maximum allowed user post length. Enter zero to disable"),
  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. ]