import socket
from django import forms
from django.utils.translation import ugettext as _
+from django.contrib.admin.widgets import FilteredSelectMultiple, AdminDateWidget
from qanda import TitleField, EditorField
from forum import settings
from forum.models.node import NodeMetaClass
+from forum.models import User
class IPListField(forms.CharField):
def clean(self, value):
return """
<input class="url_field" type="text" name="%(name)s" value="%(value)s" />
- <a class="url_field_anchor" target="_blank" href="%(app_url)s%(script_alias)s"></a>
- """ % {'name': name, 'value': value, 'app_url': settings.APP_URL,
- 'script_alias': settings.FORUM_SCRIPT_ALIAS}
+ <a class="url_field_anchor" target="_blank" href="%(app_url)s"></a>
+ """ % {'name': name, 'value': value, 'app_url': settings.APP_URL}
class PageForm(forms.Form):
comments = forms.BooleanField(label=_("Allow comments"), initial=False, required=False)
-TEXT_IN_CHOICES = (
-('title', _('Title')),
-('body', _('Body')),
-('both', _('Title and Body'))
-)
+from forum.forms.auth import SimpleRegistrationForm
+from forum.forms.general import SetPasswordForm
-class NodeManFilterForm(forms.Form):
- node_type = forms.CharField(widget=forms.HiddenInput, initial='all')
- state_type = forms.CharField(widget=forms.HiddenInput, initial='any')
- text = forms.CharField(required=False, widget=forms.TextInput(attrs={'size': 40}))
- text_in = forms.ChoiceField(required=False, widget=forms.RadioSelect, choices=TEXT_IN_CHOICES, initial='title')
+class CreateUserForm(SimpleRegistrationForm, SetPasswordForm):
+ validate_email = forms.BooleanField(required=False, label=_('send validation email'))
-NODE_SHOW_CHOICES = (
-('score', _('Score')),
-('added_at', 'Added at'),
-('last_activity_at', 'Last activity at'),
-('last_activity_by', 'Last activity by')
-)
+ def __init__(self, *args, **kwargs):
+ super(CreateUserForm, self).__init__(*args, **kwargs)
+ self.fields.keyOrder = ['username', 'email', 'validate_email', 'password1', 'password2']
+ self.fields['email'].label = _('email address')
-class NodeManShowForm(forms.Form):
- show = forms.MultipleChoiceField(choices=NODE_SHOW_CHOICES, widget=forms.CheckboxSelectMultiple)
-
\ No newline at end of file
+