thumbnail loading
This commit is contained in:
parent
c42653df80
commit
6ad7f0cfbd
|
@ -3,7 +3,6 @@ Title: Bash Arrays
|
||||||
Subtitle: sub
|
Subtitle: sub
|
||||||
Desc: Brief intro to Bash Arrays
|
Desc: Brief intro to Bash Arrays
|
||||||
Date: 2023-09-29
|
Date: 2023-09-29
|
||||||
Thumbnail: media/thumbnails/wayland.png
|
|
||||||
Keywords: bash
|
Keywords: bash
|
||||||
technology
|
technology
|
||||||
Category: Test
|
Category: Test
|
||||||
|
|
|
@ -3,6 +3,7 @@ Title: Bash Arrays
|
||||||
Subtitle: sub
|
Subtitle: sub
|
||||||
Desc: Brief intro to Bash Arrays
|
Desc: Brief intro to Bash Arrays
|
||||||
Date: 2023-09-29
|
Date: 2023-09-29
|
||||||
|
Thumbnail: img/thumbnails/bash.png
|
||||||
Keywords: bash
|
Keywords: bash
|
||||||
technology
|
technology
|
||||||
Category: Test
|
Category: Test
|
||||||
|
|
|
@ -54,7 +54,10 @@ class BlogPost(Searchable):
|
||||||
body_de = models.TextField(blank=True, default="")
|
body_de = models.TextField(blank=True, default="")
|
||||||
category = models.ForeignKey(
|
category = models.ForeignKey(
|
||||||
Category, on_delete=models.SET_NULL, null=True)
|
Category, on_delete=models.SET_NULL, null=True)
|
||||||
thumbnail = models.ImageField(blank=True, upload_to="img/thumbnails")
|
thumbnail = models.ImageField(
|
||||||
|
blank=True,
|
||||||
|
upload_to="img/thumbnails",
|
||||||
|
default="img/thumbnails/default.jpg")
|
||||||
featured = models.BooleanField(default=False)
|
featured = models.BooleanField(default=False)
|
||||||
langs = models.CharField(
|
langs = models.CharField(
|
||||||
default="['en': False, 'de': False]", max_length=64)
|
default="['en': False, 'de': False]", max_length=64)
|
||||||
|
@ -107,9 +110,9 @@ class BlogPost(Searchable):
|
||||||
self.date = meta_en["date"][0]
|
self.date = meta_en["date"][0]
|
||||||
self.featured = meta_en["featured"][0] == "True"
|
self.featured = meta_en["featured"][0] == "True"
|
||||||
self.public = meta_en["public"][0] == "True"
|
self.public = meta_en["public"][0] == "True"
|
||||||
# self.thumbnail = meta_en["thumbnail"]
|
if "thumbnail" in meta_en:
|
||||||
|
self.thumbnail = meta_en["thumbnail"][0]
|
||||||
# TODO: parse keywords from markdown
|
# TODO: parse keywords from markdown
|
||||||
# TODO: parse category from markdown
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
category: Category = Category.objects.get(
|
category: Category = Category.objects.get(
|
||||||
|
@ -120,8 +123,6 @@ class BlogPost(Searchable):
|
||||||
logger.debug(f"category of {self}: {category}")
|
logger.debug(f"category of {self}: {category}")
|
||||||
self.category = category
|
self.category = category
|
||||||
|
|
||||||
# if keyword or category do not exist, create them
|
|
||||||
# I suppose
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"could not generate metadata {self.slug} from markdown: {e}")
|
f"could not generate metadata {self.slug} from markdown: {e}")
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 62 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
Loading…
Reference in New Issue