Django Library Users
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

parameter.py 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import config
  2. from django.conf import settings
  3. from django.utils.translation import gettext as _
  4. USERS_SELF_REGISTRATION = "USERS_SELF_REGISTRATION"
  5. USERS_MAIL_VALIDATION = "USERS_MAIL_VALIDATION"
  6. USERS_ADMIN_ACTIVATION = "USERS_ADMIN_ACTIVATION"
  7. DEFAULTS = {
  8. USERS_SELF_REGISTRATION: False,
  9. USERS_MAIL_VALIDATION: True,
  10. USERS_ADMIN_ACTIVATION: True,
  11. }
  12. def get(key):
  13. # take data from config, settings or defaults
  14. try:
  15. data = getattr(config, key)
  16. except AttributeError:
  17. try:
  18. data = getattr(settings, key)
  19. except AttributeError:
  20. data = DEFAULTS.get(key)
  21. return data
  22. def registration_flow_description(username):
  23. if not get(USERS_MAIL_VALIDATION) and not get(USERS_ADMIN_ACTIVATION):
  24. return _("Your account has been created. You are now able to Login as %s.") % username
  25. elif get(USERS_MAIL_VALIDATION) and get(USERS_ADMIN_ACTIVATION):
  26. return _("Your account has been created. You'll get an email to validate your account. Then you have to wait for the activation by an administrator.")
  27. elif get(USERS_MAIL_VALIDATION):
  28. return _("Your account has been created. You'll get an email to validate your account. After validation you are able to Login as %s.") % username
  29. else:
  30. return _("Your account has been created. You have to wait for the activation by an administrator.")