0002_threads_settings.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. '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. },
  51. {
  52. 'setting': 'post_length_max',
  53. 'name': _("Maximum length"),
  54. 'description': _("Maximum allowed user post length. Enter zero to disable"),
  55. 'python_type': 'int',
  56. 'value': 60000,
  57. 'field_extra': {
  58. 'min_value': 0,
  59. },
  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. ]