html template working with jinja templates

This commit is contained in:
msramalho
2023-01-10 00:22:16 +00:00
parent aac16fa8c2
commit d4825196f1
11 changed files with 369 additions and 164 deletions

View File

@@ -3,8 +3,7 @@ from __future__ import annotations
from ast import List
from typing import Any, Union, Dict
from dataclasses import dataclass
from datetime import datetime
import json
import mimetypes
@dataclass
@@ -12,5 +11,11 @@ class Media:
filename: str
key: str = None
cdn_url: str = None
mimetype: str = None # eg: image/jpeg
# id: str = None
# hash: str = None # TODO: added by enrichers
def set_mimetype(self) -> Media:
if not self.mimetype:
self.mimetype = mimetypes.guess_type(self.filename)[0]
return self