fixtures.py 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. from misago.ranks.models import Rank
  2. from misago.settings.fixtures import load_settings_fixture, update_settings_fixture
  3. from misago.utils import ugettext_lazy as _
  4. from misago.utils import get_msgid
  5. settings_fixtures = (
  6. # Users Ranking Settings
  7. ('ranking', {
  8. 'name': _("Members Ranking"),
  9. 'description': _("Those settings control mechanisms of members activity ranking which allows you to gamificate your forum."),
  10. 'settings': (
  11. ('ranking_inflation', {
  12. 'value': 5,
  13. 'type': "integer",
  14. 'input': "text",
  15. 'extra': {'min': 0, 'max': 99},
  16. 'separator': _("Basic Ranking Settings"),
  17. 'name': _("Ranking Inflation"),
  18. 'description': _("Enter size of ranking scores inflation in percent. Scores inflation is important mechanism that allows ranking self-regulation, punishing inactivity and requiring users to remain active in order to remain high in ranking."),
  19. }),
  20. ('ranking_positions_visible', {
  21. 'value': True,
  22. 'type': "boolean",
  23. 'input': "yesno",
  24. 'name': _("Don't Keep Users Ranking Positions Secret"),
  25. 'description': _("Changing this to yes will cause forum to display user position in ranking on his profile page."),
  26. }),
  27. ('ranking_scores_visible', {
  28. 'value': True,
  29. 'type': "boolean",
  30. 'input': "yesno",
  31. 'name': _("Don't Keep Users Scores Secret"),
  32. 'description': _("Changing this to yes will cause forum to display user score on his profile page."),
  33. }),
  34. ('score_reward_new_thread', {
  35. 'value': 50,
  36. 'type': "integer",
  37. 'input': "text",
  38. 'separator': _("Posting Rewards"),
  39. 'name': _("New Thread Reward"),
  40. 'description': _("Score user will receive (or lose) whenever he posts new thread."),
  41. }),
  42. ('score_reward_new_post', {
  43. 'value': 100,
  44. 'type': "integer",
  45. 'input': "text",
  46. 'name': _("New Reply Reward"),
  47. 'description': _("Score user will receive (or lose) whenever he posts new reply in thread."),
  48. }),
  49. ('score_reward_new_post_cooldown', {
  50. 'value': 180,
  51. 'type': "integer",
  52. 'input': "text",
  53. 'extra': {'min': 0},
  54. 'name': _("Reward Cooldown"),
  55. 'description': _("Minimal time (in seconds) that has to pass between postings for new message to receive karma vote. This is useful to combat flood."),
  56. }),
  57. ('score_reward_karma_positive', {
  58. 'value': 20,
  59. 'type': "integer",
  60. 'input': "text",
  61. 'extra': {'min': 0},
  62. 'separator': _("Karma System"),
  63. 'name': _("Upvote Reward"),
  64. 'description': _("Score user will receive every time his post receives upvote."),
  65. }),
  66. ('score_reward_karma_negative', {
  67. 'value': 10,
  68. 'type': "integer",
  69. 'input': "text",
  70. 'extra': {'min': 0},
  71. 'name': _("Downvote Punishment"),
  72. 'description': _("Score user will lose every time his post receives downvote."),
  73. }),
  74. ),
  75. }),
  76. )
  77. def load_fixtures():
  78. load_settings_fixture(settings_fixtures)
  79. Rank.objects.create(
  80. name=_("Forum Team").message,
  81. name_slug='forum-team',
  82. title=_("Forum Team").message,
  83. style='rank-team',
  84. special=True,
  85. order=0,
  86. as_tab=True,
  87. on_index=True,
  88. )
  89. Rank.objects.create(
  90. name=_("Most Valuable Posters").message,
  91. name_slug='most-valuable-posters',
  92. title=_("MVP").message,
  93. style='rank-mvp',
  94. special=True,
  95. order=1,
  96. as_tab=True,
  97. )
  98. Rank.objects.create(
  99. name=_("Lurkers").message,
  100. name_slug='lurkers',
  101. order=1,
  102. criteria="100%"
  103. )
  104. Rank.objects.create(
  105. name=_("Members").message,
  106. name_slug='members',
  107. order=2,
  108. criteria="75%"
  109. )
  110. Rank.objects.create(
  111. name=_("Active Members").message,
  112. name_slug='active-members',
  113. style='rank-active',
  114. order=3,
  115. criteria="10%",
  116. as_tab=True,
  117. )
  118. def update_fixtures():
  119. update_settings_fixture(settings_fixtures)