def clean_version(self): if not VERSION_RE.match(self.cleaned_data['version']): raise forms.ValidationError(_('The version string is invalid.')) return self.cleaned_data['version']