tutorial icon indicating copy to clipboard operation
tutorial copied to clipboard

All posts are listed with their full text

Open sagayev opened this issue 8 years ago • 2 comments

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 %}

sagayev avatar Mar 01 '17 18:03 sagayev

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

ekohl avatar Nov 17 '18 11:11 ekohl

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.

das-g avatar Nov 17 '18 11:11 das-g