TemplatePropusk.py 485 B

12345678910111213141516
  1. from jinja2 import Environment, FileSystemLoader
  2. class TemplatePropusk:
  3. def __init__(self, obj: any, env_dir: str, name_file: str = "template_propusk.html"):
  4. self._env = Environment(loader=FileSystemLoader(env_dir))
  5. self._obj = obj
  6. self._rederer_text = self._env.get_template(name_file).render(
  7. self._obj
  8. )
  9. def __str__(self) -> str:
  10. return self._rederer_text
  11. def get_object(self) -> any:
  12. return self._obj