New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template #25
Comments
Hi StudentDwid, I was able to get it working by rendering the markdown in views.py then passing it to templates. I wanted to render the text in the object post.text then pass it to templates to render blog/post_list.html.This is how it looks: views.py: from markdownx.utils import markdownify
posts = Post.objects.filter(published_date__lte=timezone.now())
def post_list(request):
for post in posts:
post.text = markdownify(post.text)
return render(request, 'blog/post_list.html', {'posts': posts}) post_list.html: <div class="post">
<h1>
<a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a>
</h1>
<p>{{ post.text|safe }}</p>
</div> |
It`s work, Thank you 馃槃 |
No problem, glad its working for you. 馃槂 |
this doesn't work for me :( |
I have a paginator with this class PostListView(ListView): and I can't do markdownify(post.text) |
I got it! class PostListView(ListView): change my query before returns
|
Is there a solution for "unmarkdownify"? |
sujan-sube this works for me - I'm new to markdownx as of 2 days ago. This example helped me get things working the way I like. May I suggest adding it to the docs? I think it deals with #74 too. |
Hello, can you help me ? 馃槃
I don`t know how to show my markdown data on template.
I have something like
and i see only
but i want compiled version (with image)
Could you explain how templates with markdownx work ? Or create some exaple with that ? 馃槃
The text was updated successfully, but these errors were encountered: