{% extends "blog/base.html" %}
{% load blog_tags %}
{% block title %}{{ post.title }}{% endblock %}

{% block content %}
  <h1>{{ post.title }}</h1>
  <p class="date">
    Opublikowany {{ post.publish }} przez {{ post.author }}
  </p>
  {{ post.body|markdown }}
  
 
<h2>Podobne posty</h2>
{% for post in similar_posts %}
  <p>
    <a href="{{ post.get_absolute_url }}">{{ post.title }}</a>
  </p>
{% empty %}
  Nie ma podobnych postów.
{% endfor %}
{% with comments.count as total_comments %}
  <h2>
    {{ total_comments }} komentarz{{ total_comments|pluralize:"y" }}
  </h2>
{% endwith %}
 {% for comment in comments %}
  <div class="comment">
    <p class="info">
      Komentarz {{ forloop.counter }} dodany przez {{ comment.name }}
      {{ comment.created }}
    </p>
    {{ comment.body|linebreaks }}
  </div>
{% empty %}
  <p>Nie ma jeszcze żadnych komentarzy.</p>
{% endfor %}

  {% if new_comment %}
    <h2>Komentarz został dodany.</h2>
  {% else %}
    <h2>Dodaj nowy komentarz</h2>
    <form action="." method="post">
      {{ comment_form.as_p }}
      {% csrf_token %}
      <p><input type="submit" value="Dodaj komentarz"></p>
    </form>
  {% endif %}
{% endblock %}
