def validate_website(url):
 validate_url = URLValidator()
 if (url and ('://' not in url)):
  url = (u'http://%s' % url)
 try:
  validate_url(url)
 except ValidationError:
  raise ValidationError(_('Enter a valid URL.'))
 return url

def validate_website ( url ) : validate_url = URLValidator ( ) if ( url and ( '://' not in url ) ) : url = ( u'http://%s' % url ) try : validate_url ( url ) except ValidationError : raise ValidationError ( _ ( 'Enter a valid URL.' ) ) return url
validate and return a properly formatted website url .