Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

post_list.html 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <!--
  2. marked parts of the template is external code
  3. import from https://tutorial.djangogirls.org/en/template_extending/
  4. -->
  5. {% extends 'base.html' %} {% block content %}
  6. <div class="row">
  7. {% if tag %} <div class="mx-auto">
  8. <h2> Artikel mit dem Tag "{{ tag.name }}" </h2>
  9. </div>{% endif %}
  10. </div>
  11. <!-- imported start -->
  12. <div class="row">
  13. <div class="mx-auto">
  14. <h1> Artikleübersicht </h1>
  15. </div>
  16. </div>
  17. <!-- imported end -->
  18. <div class="row">
  19. <div class="col-md-8">
  20. {% if messages %}
  21. <div class="messages">
  22. {% for message in messages %}
  23. <p {% if message.tags %} class="{{ message.tags }}" {% endif %}>{{ message }}</p>
  24. {% endfor %}
  25. </div>
  26. <!-- imported start -->
  27. {% endif %}
  28. {% for post in posts %}
  29. <div class="mt-5 post">
  30. <div class="date">
  31. {{ post.published_date }}
  32. </div>
  33. <h2>
  34. <a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a>
  35. </h2>
  36. <p>{{ post.text|linebreaks }}</p>
  37. <!-- imported end -->
  38. Tags: {% for tag in post.tags.all %}
  39. <a href="{% url 'post_list_by_tag' tag.slug %}">{{ tag.name }}</a>
  40. {% if not forloop.last %}, {% endif %} {% endfor %} <p>
  41. {{ post.author }}
  42. </p>
  43. </div>
  44. {% endfor %}
  45. </div>
  46. </div>
  47. {% endblock %}