0002_threads_settings.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from django.db import models, migrations
  4. from django.utils.translation import ugettext as _
  5. from misago.conf.migrationutils import migrate_settings_group
  6. def create_threads_settings_group(apps, schema_editor):
  7. migrate_settings_group(
  8. apps,
  9. {
  10. 'key': 'threads',
  11. 'name': _("Threads"),
  12. 'description': _("Those settings control threads and posts."),
  13. 'settings': (
  14. {
  15. 'setting': 'thread_title_length_min',
  16. 'name': _("Minimum length"),
  17. 'description': _("Minimum allowed thread title length."),
  18. 'legend': _("Thread titles"),
  19. 'python_type': 'int',
  20. 'value': 5,
  21. 'field_extra': {
  22. 'min_value': 2,
  23. 'max_value': 255,
  24. },
  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. },
  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. },
  48. {
  49. 'setting': 'post_length_max',
  50. 'name': _("Maximum length"),
  51. 'description': _("Maximum allowed user post length. Enter zero to disable"),
  52. 'python_type': 'int',
  53. 'value': 60000,
  54. 'field_extra': {
  55. 'min_value': 0,
  56. },
  57. },
  58. )
  59. })
  60. class Migration(migrations.Migration):
  61. dependencies = [
  62. ('misago_threads', '0001_initial'),
  63. ('misago_conf', '0001_initial'),
  64. ]
  65. operations = [
  66. migrations.RunPython(create_threads_settings_group),
  67. ]