forms.py 1.2 KB

12345678910111213141516171819
  1. from django.utils.translation import ugettext_lazy as _
  2. import floppyforms as forms
  3. from misago.forms import Form, ForumMultipleChoiceField
  4. from misago.models import Role, Forum
  5. from misago.validators import validate_sluggable
  6. class PrefixForm(Form):
  7. name = forms.CharField(label=_("Prefix Name"),
  8. max_length=16, validators=[validate_sluggable(
  9. _("Prefix must contain alphanumeric characters."),
  10. _("Prefix name is too long.")
  11. )])
  12. style = forms.CharField(label=_("Prefix CSS Class"),
  13. help_text=_("CSS class that will be used to style this thread prefix."),
  14. max_length=255, required=False)
  15. forums = ForumMultipleChoiceField(label=_("Prefix Forums"),
  16. help_text=_("Select forums in which this prefix will be available."),
  17. level_indicator=u'- - ',
  18. queryset=Forum.objects.get(special='root').get_descendants())