destroying.py 773 B

123456789101112131415161718192021222324
  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 = _("Destroying user accounts")
  6. can_destroy_user_newer_than = forms.IntegerField(
  7. label=_("Maximum age of destroyed account (in days)"),
  8. help_text=_("Enter zero to disable this check."),
  9. initial=0,
  10. min_value=0)
  11. can_destroy_users_with_less_posts_than = forms.IntegerField(
  12. label=_("Maximum number of posts on destroyed account"),
  13. help_text=_("Enter zero to disable this check."),
  14. initial=0,
  15. min_value=0)
  16. def change_permissions_form(role):
  17. if role.__class__ == Role:
  18. return PermissionsForm
  19. else:
  20. return None