Skip to content

Instantly share code, notes, and snippets.

@bahiamartins
bahiamartins / next_previous.py
Created February 5, 2017 10:17 — forked from dokterbob/next_previous.py
Django template tag to efficiently get the next or previous object in the Django queryset, with regards to the item specified.
from django import template
register = template.Library()
from templatetag_sugar.register import tag
from templatetag_sugar.parser import Constant, Variable, Name
from .utils import get_next_or_previous
"""
Efficient and generic get next/previous tags for the Django template language,