blog-markdown #31

Merged
PlexSheep merged 27 commits from blog-markdown into devel 2023-10-02 11:31:41 +02:00
1 changed files with 10 additions and 2 deletions
Showing only changes of commit b269b452fd - Show all commits

View File

@ -5,7 +5,7 @@ import pathlib
import markdown import markdown
from django.db import models from django.db import models
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from start.models import Searchable from start.models import Keyword, Searchable
import logging import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -129,7 +129,15 @@ class BlogPost(Searchable):
logger.debug(f"category of {self}: {category}") logger.debug(f"category of {self}: {category}")
self.category = category self.category = category
self.keywords = None for item in meta_en["keywords"]:
try:
keyword: Keyword = Keyword.objects.get(
slug=item)
except Keyword.DoesNotExist:
keyword = Keyword.objects.create(
slug=item, text_en=item, text_de=item)
logger.debug(f"keywords of '{self}': {self.keywords}")
except Exception as e: except Exception as e:
logger.warning( logger.warning(