From 84acc3c76efe8a0a04081711ff53ce82a1e9d4e8 Mon Sep 17 00:00:00 2001 From: moanos Date: Sun, 20 Jul 2025 07:58:36 +0200 Subject: [PATCH] feat: format posts in markdown --- .../templates/fellchensammlung/misc/fediverse/an-post.md | 8 ++++++++ src/fellchensammlung/tools/fedi.py | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/fellchensammlung/templates/fellchensammlung/misc/fediverse/an-post.md diff --git a/src/fellchensammlung/templates/fellchensammlung/misc/fediverse/an-post.md b/src/fellchensammlung/templates/fellchensammlung/misc/fediverse/an-post.md new file mode 100644 index 0000000..566e92b --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/misc/fediverse/an-post.md @@ -0,0 +1,8 @@ +### {{ adoption_notice.name }} + +📍 {{ adoption_notice.location }} + + +{{ adoption_notice.description }} + +{{ adoption_notice.get_full_url}} \ No newline at end of file diff --git a/src/fellchensammlung/tools/fedi.py b/src/fellchensammlung/tools/fedi.py index 4e9ba08..a408f53 100644 --- a/src/fellchensammlung/tools/fedi.py +++ b/src/fellchensammlung/tools/fedi.py @@ -1,5 +1,6 @@ import logging import requests +from django.template.loader import render_to_string from fellchensammlung.models import SocialMediaPost, PlatformChoices from notfellchen import settings @@ -81,7 +82,8 @@ class FediClient: def post_an_to_fedi(adoption_notice): client = FediClient(settings.fediverse_access_token, settings.fediverse_api_base_url) - status_text = adoption_notice.name + context = {"adoption_notice": adoption_notice} + status_text = render_to_string("fellchensammlung/misc/fediverse/an-post.md", context) images = adoption_notice.get_photos() if images is not None: