2020-12-18 19:30:09 +01:00
|
|
|
from django.views.generic import DetailView
|
|
|
|
from django.utils.safestring import mark_safe
|
|
|
|
from markdownx.utils import markdownify
|
|
|
|
from .models import MarkdownPage
|
2020-10-11 22:16:00 +02:00
|
|
|
|
|
|
|
|
2020-12-18 19:30:09 +01:00
|
|
|
class MarkdownPageView(DetailView):
|
|
|
|
model = MarkdownPage
|
2020-12-27 12:48:08 +01:00
|
|
|
template_name = "website/markdown_page.html"
|
2020-12-18 19:30:09 +01:00
|
|
|
|
|
|
|
def get_context_data(self, **kwargs):
|
|
|
|
context = super().get_context_data(**kwargs)
|
|
|
|
context["markdown_body"] = mark_safe(markdownify(self.object.content))
|
|
|
|
return context
|