{% load card_badge %}
{% load pagination_tags %}
{% if group_by and groups %}
    {% for group in groups %}
        <div class="divider">{{ group.group }}</div>
        <div class="flex justify-center flex-wrap">
            {% for card in group.cards %}
                <a href="{% url 'cards:card_detail' card.pk %}">
                    {% card_badge card expanded=True %}
                </a>
            {% endfor %}
        </div>
    {% endfor %}
{% else %}
    <div class="flex justify-center flex-wrap">
        {% for card in cards %}
            <a href="{% url 'cards:card_detail' card.pk %}">
                {% card_badge card expanded=True %}
            </a>
        {% endfor %}
    </div>
{% endif %}

<!-- Somewhere in your template, e.g., after the card list: -->
{% if page_obj %}
    {% render_pagination page_obj %}
{% endif %}
