account.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from django.utils.translation import ugettext_lazy as _
  2. from misago.acl.models import Role
  3. from misago.core import forms
  4. DEFAULT_PERMISSIONS = {
  5. 'name_changes_allowed': 1,
  6. 'changes_expire': 0,
  7. 'can_use_signature': True,
  8. 'allow_signature_links': True,
  9. 'allow_signature_images': False,
  10. }
  11. class PermissionsForm(forms.Form):
  12. legend = _("Account settings")
  13. name_changes_allowed = forms.IntegerField(
  14. label=_("Allowed username changes number"),
  15. min_value=0,
  16. initial=1)
  17. changes_expire = forms.IntegerField(
  18. label=_("Don't count username changes older than"),
  19. help_text=_("Number of days since name change that makes that change no longer count to limit. Enter zero to make all changes count."),
  20. min_value=0,
  21. initial=0)
  22. can_use_signature = forms.YesNoSwitch(
  23. label=_("Can have signature"),
  24. initial=True)
  25. allow_signature_links = forms.YesNoSwitch(
  26. label=_("Can put links in signature"),
  27. initial=True)
  28. allow_signature_images = forms.YesNoSwitch(
  29. label=_("Can put images in signature"))
  30. def change_permissions_form(role):
  31. if role.__class__ == Role:
  32. return PermissionsForm
  33. else:
  34. return None