{% extends "notes/base.html" %}
{%load static%}
{%load viewans%}
{% load crispy_forms_tags %}
{% block content %}
<div class="col-sm-6">
    <div class="card-deck">
        <form class="form-inline" method="GET" autocomplete="off" action="/practice/general/">
            <div class="input-group">
                <input class="form-control mr-sm-2" type="search" name="q" class="form-control"
                    placeholder="content/keyword">
                <span class="input-group-btn">
                    <button class="btn btn-primary" type="submit">Search</button>
                </span>
            </div>
        </form>
    </div>
</div>

<!--Improve Search with Incremental Search (AJAX and JQuery)-->

<small class="text-muted"> Your query has returned {{ paginator.count }}
    result{{ paginator.count|pluralize }}.</small>

<br>
<p style="font-size: small;">Practice <a href="{%url 'coder:list-python'%}">Python</a> | <a href="{%url 'coder:list-java'%}">Java</a> | <a
    href="{%url 'coder:list-general'%}">General</a> |<a href="{%url 'coder:home'%}"> Look at what "Practice is all
    about".</a></p>

<h1>Practice </h1>

<br>

{% for object in question %}
<article class="media content-section shadow">
    <div class="media-body container-fluid">


        <span class="badge badge-light badge-pill">{{object.category}}</span>
        <span class="badge badge-dark badge-pill">{{object.typeof}}</span>
        <h3><a class="article-title" href="{%url 'coder:detail' object.slug%}">{{object.title }}</a></h3>

    </div>
</article>
{% endfor %}



{% if page_obj.has_previous %}

<a class="page-link badge badge-dark badge-pill"
    href="?{% if query %}q={{query}}&{% endif %}page={{ page_obj.previous_page_number }}">&laquo; Previous</a>

{% endif %}

{% for i in page_obj.paginator.page_range %}
{% if page_obj.number == i %}
<a class="page-link badge badge-dark badge-pill">Page {{ i }}</a>
{% else %}
<a class="page-link badge badge-dark badge-pill" href="?{% if query %}q={{query}}&{% endif %}page={{ i }}">
    {{ i }}</a>

{% endif %}
{% endfor %}

{% if page_obj.has_next %}

<a class="page-link badge badge-dark badge-pill"
    href="?{% if query %}q={{query}}&{% endif %}page={{ page_obj.next_page_number }}">Next</a>


<a class="page-link badge badge-dark badge-pill"
    href="?{% if query %}q={{query}}&{% endif %}page={{ page_obj.paginator.num_pages }}">Last
    &raquo;</a>

{% endif %}

<br>


{% endblock content %}
