blog-markdown #31
|
@ -5,7 +5,7 @@ import pathlib
|
|||
import markdown
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext as _
|
||||
from start.models import Searchable
|
||||
from start.models import Keyword, Searchable
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -129,7 +129,15 @@ class BlogPost(Searchable):
|
|||
logger.debug(f"category of {self}: {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:
|
||||
logger.warning(
|
||||
|
|
Loading…
Reference in New Issue