from pathlib import Path from shutil import copytree, rmtree import click from flask_admin import __file__ as flask_admin_path def _copy_admin_templates(): src = Path(flask_admin_path).parent / "templates/bootstrap4/admin" if not src.is_dir(): click.echo(click.style(f"Templates could not be found at {src}", fg="red")) return dist = Path("advlabdb/templates/admin") if dist.is_dir(): if not click.confirm( click.style(f"The directory {dist} already exists! Do you want to overwrite it?", fg="yellow") ): return rmtree(dist) click.echo(click.style("Old templates deleted!", fg="yellow")) copytree(src, dist) click.echo(click.style(f"Copied {src} -> {dist}", fg="green")) click.echo( click.style( f""" _________ | WARNING | ------- | You might have to edit the file {dist}/base.html | by adding nav in the following way: | This line:\t