0002_threads_settings.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from django.conf import settings
  4. from django.db import models, migrations
  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. },
  27. {
  28. 'setting': 'thread_title_length_max',
  29. 'name': _("Maximum length"),
  30. 'description': _("Maximum allowed thread length."),
  31. 'python_type': 'int',
  32. 'value': 90,
  33. 'field_extra': {
  34. 'min_value': 2,
  35. 'max_value': 255,
  36. },
  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. },
  49. {
  50. 'setting': 'post_length_max',
  51. 'name': _("Maximum length"),
  52. 'description': _("Maximum allowed user post length. Enter zero to disable"),
  53. 'python_type': 'int',
  54. 'value': 60000,
  55. 'field_extra': {
  56. 'min_value': 0,
  57. },
  58. },
  59. )
  60. })
  61. class Migration(migrations.Migration):
  62. dependencies = [
  63. ('misago_threads', '0001_initial'),
  64. ('misago_conf', '0001_initial'),
  65. ]
  66. operations = [
  67. migrations.RunPython(create_threads_settings_group),
  68. ]