'Ensure the name of the field only contains alphanumeric'

def clean_name(self):

    name = self.cleaned_data['name']
    if (not re.match('^[a-zA-Z0-9-_]+$', name)):
        raise forms.ValidationError(_('Sorry,    field    names    can    only    contain    letters,    numbers,    hyphens    (-)    and    underscores    (_)'))
    return name
