defaults.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. """
  2. Default settings for all mezzanine.accounts app. Each of these can be
  3. overridden in your project's settings module, just like regular
  4. Django settings. The ``editable`` argument for each controls whether
  5. the setting is editable via Django's admin.
  6. Thought should be given to how a setting is actually used before
  7. making it editable, as it may be inappropriate - for example settings
  8. that are only read during startup shouldn't be editable, since changing
  9. them would require an application reload.
  10. """
  11. from __future__ import unicode_literals
  12. from django.utils.translation import ugettext_lazy as _
  13. from mezzanine.conf import register_setting
  14. from django.conf import settings
  15. profile_model_default = getattr(settings, "AUTH_PROFILE_MODULE", None)
  16. if profile_model_default:
  17. from warnings import warn
  18. warn("Django's AUTH_PROFILE_MODULE setting is deprecated, use "
  19. "Mezzanine's ACCOUNTS_PROFILE_MODEL instead.")
  20. register_setting(
  21. name="ACCOUNTS_PROFILE_MODEL",
  22. description=_("String in the form `app_label.model_name` for the model "
  23. "used for account profiles."),
  24. editable=False,
  25. default=profile_model_default,
  26. )
  27. register_setting(
  28. name="ACCOUNTS_MIN_PASSWORD_LENGTH",
  29. description=_("Minimum length for passwords"),
  30. editable=False,
  31. default=6,
  32. )
  33. register_setting(
  34. name="ACCOUNTS_NO_USERNAME",
  35. description=_("If ``True``, the username field will be excluded "
  36. "from sign up and account update forms."),
  37. editable=False,
  38. default=False,
  39. )
  40. register_setting(
  41. name="ACCOUNTS_PROFILE_FORM_EXCLUDE_FIELDS",
  42. description=_("List of fields to exclude from the profile form."),
  43. editable=False,
  44. default=(),
  45. )
  46. register_setting(
  47. name="ACCOUNTS_PROFILE_FORM_CLASS",
  48. description=_("Dotted package path and class name of profile form to use "
  49. "for users signing up and updating their profile, when "
  50. "``mezzanine.accounts`` is installed."),
  51. editable=False,
  52. default="mezzanine.accounts.forms.ProfileForm",
  53. )
  54. register_setting(
  55. name="ACCOUNTS_PROFILE_VIEWS_ENABLED",
  56. description=_("If ``True``, users will have their own public profile "
  57. "pages."),
  58. editable=False,
  59. default=False,
  60. )
  61. register_setting(
  62. name="ACCOUNTS_VERIFICATION_REQUIRED",
  63. description=_("If ``True``, when users create an account, they will be "
  64. "sent an email with a verification link, which they must click to "
  65. "enable their account."),
  66. editable=False,
  67. default=False,
  68. )
  69. register_setting(
  70. name="ACCOUNTS_APPROVAL_REQUIRED",
  71. description=_("If ``True``, when users create an account, they will "
  72. "not be enabled by default and a staff member will need to activate "
  73. "their account in the admin interface."),
  74. editable=False,
  75. default=False,
  76. )
  77. register_setting(
  78. name="ACCOUNTS_APPROVAL_EMAILS",
  79. label=_("Account approval email addresses"),
  80. description=_("A comma separated list of email addresses that "
  81. "will receive an email notification each time a "
  82. "new account is created that requires approval."),
  83. editable=True,
  84. default="",
  85. )