fixtures.py 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. from misago.settings.fixtures import load_settings_fixture, update_settings_fixture
  2. from misago.utils import ugettext_lazy as _
  3. from misago.utils import get_msgid
  4. settings_fixtures = (
  5. # Spam Countermeasures
  6. ('spam', {
  7. 'name': _("Spam Countermeasures"),
  8. 'description': _("Those settings allow you to combat automatic registrations and spam messages on your forum."),
  9. 'settings': (
  10. ('bots_registration', {
  11. 'type': "string",
  12. 'input': "choice",
  13. 'extra': {'choices': [('', _("No protection")), ('recaptcha', _("reCaptcha")), ('qa', _("Question & Answer"))]},
  14. 'separator': _("Spambots Registrations"),
  15. 'name': _("CAPTCHA type"),
  16. 'description': _('CAPTCHA stands for "Completely Automated Public Turing test to tell Computers and Humans Apart". Its type of test developed on purpose of blocking automatic registrations.'),
  17. 'position': 0,
  18. }),
  19. ('recaptcha_public', {
  20. 'type': "string",
  21. 'input': "text",
  22. 'separator': _("reCaptcha"),
  23. 'name': _("Public Key"),
  24. 'description': _("Enter public API key that you have received from reCaptcha."),
  25. 'position': 1,
  26. }),
  27. ('recaptcha_private', {
  28. 'type': "string",
  29. 'input': "text",
  30. 'name': _("Private Key"),
  31. 'description': _("Enter private API key that you have received from reCaptcha."),
  32. 'position': 2,
  33. }),
  34. ('qa_test', {
  35. 'type': "string",
  36. 'input': "text",
  37. 'separator': _("Question and Answer Test"),
  38. 'name': _("Question"),
  39. 'description': _("Question visible to your users."),
  40. 'position': 3,
  41. }),
  42. ('qa_test_help', {
  43. 'type': "string",
  44. 'input': "text",
  45. 'name': _("Help Message"),
  46. 'description': _("Optional help message displayed on form."),
  47. 'position': 4,
  48. }),
  49. ('qa_test_answers', {
  50. 'type': "string",
  51. 'input': "textarea",
  52. 'name': _("Answers"),
  53. 'description': _("Enter allowed answers to this question, each in new line. Test is case-insensitive."),
  54. 'position': 5,
  55. }),
  56. ),
  57. }),
  58. )
  59. def load_fixtures():
  60. load_settings_fixture(settings_fixtures)
  61. def update_fixtures():
  62. update_settings_fixture(settings_fixtures)