@register.inclusion_tag('<STR_LIT>')<EOL>def paginate_update(update):
from happenings.models import Update<EOL>time = update.pub_time<EOL>event = update.event<EOL>try:<EOL><INDENT>next = Update.objects.filter(<EOL>event=event,<EOL>pub_time__gt=time<EOL>).order_by('<STR_LIT>').only('<STR_LIT:title>')[<NUM_LIT:0>]<EOL><DEDENT>except:<EOL><INDENT>next = None<EOL><DEDENT>try:<EOL><INDENT>previous = Update.objects.filter(<EOL>event=event,<EOL>pub_time__lt=time<EOL>).order_by('<STR_LIT>').only('<STR_LIT:title>')[<NUM_LIT:0>]<EOL><DEDENT>except:<EOL><INDENT>previous = None<EOL><DEDENT>return {'<STR_LIT>': next, '<STR_LIT>': previous, '<STR_LIT>': event}<EOL>
attempts to get next and previous on updates