{% extends 'base.html' %}
{% load i18n %}

{% block title %}
{{ category.name }}
{% endblock %}

{% block body %}
<h1>{% trans 'Category' %} <em>{{ category.name }}</em></h1>

{% for post in page_obj %}
<article class="media">
  <div class="media-body">
    <h4 class="media-heading"><a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a></h4>
    <p>{{ post.description }}</p>
  </div>
</article>
{% empty %}
<p class="lead">{% trans 'Sorry, nothing to see yet.' %}</p>
{% endfor %}

<nav>
  <ul class="pager">
    {% if page_obj.has_previous %}
    <li class="previous"><a href="{% url 'category_detail_list' pk=category.pk page=page_obj.previous_page_number %}">&larr; {% trans 'Previous' %}</a></li>
    {% endif %}

    {% if page_obj.has_next %}
    <li class="next"><a href="{% url 'category_detail_list' pk=category.pk page=page_obj.next_page_number %}">{% trans 'Next' %} &rarr;</a></li>
    {% endif %}
  </ul>
</nav>

{% endblock %}
