account.py 1.0 KB

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