<s> from __future__ import unicode_literals <EOL> from django . template . loader import render_to_string <EOL> from django . core . paginator import Page <EOL> from . registry import register <EOL> @ register . simple_tag ( takes_context = True ) <EOL> def render_paginator ( context , page , page_var = '<STR_LIT>' , hashtag = '<STR_LIT>' ) : <EOL> query_dict = context [ "<STR_LIT>" ] . GET . copy ( ) <EOL> try : <EOL> del query_dict [ page_var ] <EOL> except KeyError : <EOL> pass <EOL> extra_query = "<STR_LIT>" <EOL> if query_dict : <EOL> extra_query = "<STR_LIT>" % query_dict . urlencode ( ) <EOL> if hashtag : <EOL> hashtag = "<STR_LIT>" % hashtag <EOL> new_context = { <EOL> "<STR_LIT>" : page , <EOL> "<STR_LIT>" : page_var , <EOL> "<STR_LIT>" : hashtag , <EOL> "<STR_LIT>" : extra_query <EOL> } <EOL> if isinstance ( page , Page ) : <EOL> template = "<STR_LIT>" <EOL> else : <EOL> template = "<STR_LIT>" <EOL> return render_to_string ( template , new_context ) </s>
