{% extends "base.html" %}

{% block "content" %}
  <h1>Recherche</h1>
  <form class="search" method="get">
    {{ form.q }}
    <button type="submit"><i class="fa fa-fw fa-search" aria-hidden="true"></i></button>
  </form>

  {% if query %}
    <hr/>

    {% for result in page_obj.object_list %}
      {% if result.model_name == "game" %}
        {% include "./partials/game_item.html" with game=result.object %}
      {% elif result.model_name == "category" %}
        {% include "./partials/category_item.html" with category=result.object %}
      {% elif result.model_name == "tag" %}
        {% include "./partials/tag_item.html" with tag=result.object %}
      {% endif %}
    {% empty %}
      Aucun résultat trouvé
    {% endfor %}

    {% include "./partials/pagination.html" %}
  {% endif %}
{% endblock %}
