def __init__(self, *args, **kwargs): super(LoginForm, self).__init__(*args, **kwargs) try: if reduce((lambda x, y: x + 1), Server, 0) > 1: self.fields['server'] = ServerModelChoiceField( Server, empty_label=u"---------") else: self.fields['server'] = ServerModelChoiceField( Server, empty_label=None) except: self.fields['server'] = ServerModelChoiceField( Server, empty_label=u"---------") self.fields.keyOrder = ['server', 'username', 'password', 'ssl']
class ForgottonPasswordForm(NonASCIIForm): server = ServerModelChoiceField(Server, empty_label=u"---------") username = forms.CharField(max_length=50, widget=forms.TextInput(attrs={ 'size': 28, 'autocomplete': 'off' })) email = forms.EmailField(widget=forms.TextInput(attrs={ 'size': 28, 'autocomplete': 'off' }))
def __init__(self, *args, **kwargs): super(LoginForm, self).__init__(*args, **kwargs) self.fields['server'] = ServerModelChoiceField(Server, empty_label=None) self.fields.keyOrder = ['server', 'username', 'password', 'ssl']