def create_range(range_class):
 if (not hasattr(range_class, 'name')):
  raise exceptions.ValidationError('A custom range must have a name attribute')
 if (range_class.name.__class__.__name__ == '__proxy__'):
  raise exceptions.ValidationError('Custom ranges must have text names (not ugettext proxies)')
 try:
  return Range.objects.create(name=range_class.name, proxy_class=_class_path(range_class))
 except IntegrityError:
  raise ValueError('The passed range already exists in the database.')

def create_range ( range_class ) : if ( not hasattr ( range_class , 'name' ) ) : raise exceptions . ValidationError ( 'A custom range must have a name attribute' ) if ( range_class . name . __class__ . __name__ == '__proxy__' ) : raise exceptions . ValidationError ( 'Custom ranges must have text names (not ugettext proxies)' ) try : return Range . objects . create ( name = range_class . name , proxy_class = _class_path ( range_class ) ) except IntegrityError : raise ValueError ( 'The passed range already exists in the database.' )
create a custom range instance from the passed range class this function creates the appropriate database record for this custom range .