DjangoGirls / tutorial

This is a tutorial we are using for Django Girls workshops
http://tutorial.djangogirls.org/
Other
1.53k stars 1.86k forks source link

All posts are listed with their full text #991

Open sagayev opened 7 years ago

sagayev commented 7 years ago

https://tutorial.djangogirls.org/en/django_templates/

I think in below code linebreaksbr should be replaced by truncatechars:200. Otherwise, there is no need to create post_detail pages, because all posts are listed with their full text in post_list.

blog/templates/blog/post_list.html

<div>
    <h1><a href="/">Django Girls Blog</a></h1>
</div>

{% for post in posts %}
    <div>
        <p>published: {{ post.published_date }}</p>
        <h1><a href="">{{ post.title }}</a></h1>
        <p>{{ post.text|linebreaksbr }}</p>
    </div>
{% endfor %}
ekohl commented 5 years ago

That makes sense. Could come up with a pull request?

das-g commented 5 years ago

I think |linebreaksbr would still be needed in case there are line breaks within the first 200 characters.

That means that if |truncatechars:200 is also added, we'd need to explain both.

Also, as the post detail page is only added 3 chapters later, maybe |truncatechars:200 should only be added to the post list page after that, so that until then, the full posts are visible somewhere. IMHO this could be another optional tutorial extension, even if it'd be a rather small one.