from django import forms


class UserNameForm(forms.Form):
    username = forms.CharField()

    def clean_username(self):
        data = self.data
        if data.get('username').isalnum():
            return data.get('username')
        else:
            raise forms.ValidationError('it contains illegal char!')
