PageRenderTime 35ms CodeModel.GetById 31ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/regressiontests/admin_views/forms.py

https://code.google.com/p/mango-py/
Python | 10 lines | 8 code | 2 blank | 0 comment | 1 complexity | cd5aca154690e61bc790827ebc87ec21 MD5 | raw file
 1from django import forms
 2from django.contrib.admin.forms import AdminAuthenticationForm
 3
 4class CustomAdminAuthenticationForm(AdminAuthenticationForm):
 5
 6    def clean_username(self):
 7        username = self.cleaned_data.get('username')
 8        if username == 'customform':
 9            raise forms.ValidationError('custom form error')
10        return username