2010-12-02 00:44:35 +00:00
|
|
|
from django import forms
|
|
|
|
from django.contrib.admin.forms import AdminAuthenticationForm
|
|
|
|
|
2011-10-13 18:51:33 +00:00
|
|
|
|
2010-12-02 00:44:35 +00:00
|
|
|
class CustomAdminAuthenticationForm(AdminAuthenticationForm):
|
|
|
|
|
2015-03-07 10:57:52 +00:00
|
|
|
class Media:
|
|
|
|
css = {'all': ('path/to/media.css',)}
|
|
|
|
|
2010-12-02 00:44:35 +00:00
|
|
|
def clean_username(self):
|
|
|
|
username = self.cleaned_data.get('username')
|
|
|
|
if username == 'customform':
|
|
|
|
raise forms.ValidationError('custom form error')
|
|
|
|
return username
|