|
@@ -1,10 +1,10 @@
|
|
from django.utils.translation import ugettext_lazy as _
|
|
from django.utils.translation import ugettext_lazy as _
|
|
import floppyforms as forms
|
|
import floppyforms as forms
|
|
from misago.forms import Form, ForumMultipleChoiceField
|
|
from misago.forms import Form, ForumMultipleChoiceField
|
|
-from misago.models import Role, Forum
|
|
|
|
|
|
+from misago.models import Forum
|
|
from misago.validators import validate_sluggable
|
|
from misago.validators import validate_sluggable
|
|
|
|
|
|
-class PrefixForm(Form):
|
|
|
|
|
|
+class PrefixFormBase(Form):
|
|
name = forms.CharField(label=_("Prefix Name"),
|
|
name = forms.CharField(label=_("Prefix Name"),
|
|
max_length=16, validators=[validate_sluggable(
|
|
max_length=16, validators=[validate_sluggable(
|
|
_("Prefix must contain alphanumeric characters."),
|
|
_("Prefix must contain alphanumeric characters."),
|
|
@@ -13,7 +13,12 @@ class PrefixForm(Form):
|
|
style = forms.CharField(label=_("Prefix CSS Class"),
|
|
style = forms.CharField(label=_("Prefix CSS Class"),
|
|
help_text=_("CSS class that will be used to style this thread prefix."),
|
|
help_text=_("CSS class that will be used to style this thread prefix."),
|
|
max_length=255, required=False)
|
|
max_length=255, required=False)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def PrefixForm(*args, **kwargs):
|
|
forums = ForumMultipleChoiceField(label=_("Prefix Forums"),
|
|
forums = ForumMultipleChoiceField(label=_("Prefix Forums"),
|
|
help_text=_("Select forums in which this prefix will be available."),
|
|
help_text=_("Select forums in which this prefix will be available."),
|
|
level_indicator=u'- - ',
|
|
level_indicator=u'- - ',
|
|
queryset=Forum.objects.get(special='root').get_descendants())
|
|
queryset=Forum.objects.get(special='root').get_descendants())
|
|
|
|
+
|
|
|
|
+ return type('FinalPrefixForm', (PrefixFormBase,), {'forums': forums})
|