Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am nnewman on github.
  • I am nnewman (https://keybase.io/nnewman) on keybase.
  • I have a public key whose fingerprint is 0BF5 212D EB79 CF6A BBE6 F265 FCFE 0321 FB47 4A1D

To claim this, I am signing this object:

@nnewman
nnewman / django-bootstrap-pagination.html
Created January 10, 2016 20:09
Template code for adding pagination to a Django template with bootstrap3 styling
{% if is_paginated %}
<nav>
<ul class="pagination">
{% if page_obj.has_previous %}
<li><a href="?page={{ page_obj.previous_page_number }}">{% if not page_obj.has_previous %}<span aria-hidden="true">{% endif %}&laquo; Previous</span><span class="sr-only">Previous</span></a></li>
{% endif %}
{% for page in paginator.page_range %}
<li {% if page_obj.number == forloop.counter %}class="active"{% endif %}><a href="?page={{forloop.counter}}">{{forloop.counter}}</a></li>
{% endfor %}
{% if page_obj.has_next %}
import asyncio
import json
import logging
import logging.handlers
import os
import time
from contextlib import asynccontextmanager
from signal import pause
from typing import AsyncContextManager, Tuple