Downloads all the views from server for the registered model
        documents into the defined :attr:`VIEW_PATHS` directory.

        This method **removes** previous views directory if exist.

def download(cls):
        """Downloads all the views from server for the registered model
        documents into the defined :attr:`VIEW_PATHS` directory.

        This method **removes** previous views directory if exist.
        """
        cls._check_folder()
        os.chdir(cls.VIEWS_PATH)
        # iterate documents
        for doc in cls._documents:
            design_doc = doc().view()
            if design_doc is None:
                continue
            bucket_name = design_doc.bucket.name
            # iterate viewtypes (i.e. spatial and views)
            for view_type, views in design_doc.ddoc.iteritems():
                save_dir = '%s/%s/%s' % (bucket_name, design_doc.name, view_type)
                try:
                    # remove and recreate the dir
                    shutil.rmtree(save_dir, ignore_errors=True)
                    os.makedirs(save_dir)
                except OSError:
                    pass
                for name, view in views.iteritems():
                    if isinstance(view, unicode) and view_type=='spatial':
                        spatial_file = '%s/%s.spatial.js' % (save_dir, name)
                        with open(spatial_file, 'w') as f:
                            f.write(view)
                        print('Downloaded: %s' % spatial_file)
                    if isinstance(view, dict) and 'map' in view:
                        map_file = '%s/%s.map.js' % (save_dir, name)
                        with open(map_file, 'w') as f:
                            f.write(view['map'])
                        print('Downloaded: %s' % map_file)
                    if isinstance(view, dict) and 'reduce' in view:
                        reduce_file = '%s/%s.reduce.js' % (save_dir, name)
                        with open(reduce_file, 'w') as f:
                            f.write(view['reduce'])
                        print('Downloaded: %s' % reduce_file)
        pass