2š
Iām not sure if I understand your question correctly, but the following might work.
Treat flatpage.content
as a template, and render it in the view with any context you wish.
# view
from django.template import Template, Context
def user_agreement(request):
flatpage = FlatPage.objects.get(key='user-agreement')
t = Template(flatpage.content)
fp_content = t.render(Context({}))
return response(request, template='misc/flatpage.html',
vars={'title': flatpage.title, 'content': fp_content})
Then apply the markdown filter in the misc/flatpage.html
template.
<h2>{% block title %}{{ title }}{% endblock %}</h2>
{{ content|markdown }}
š¤Alasdair
Source:stackexchange.com