<s> from django import template <EOL> from django . contrib . contenttypes . models import ContentType <EOL> from django . core . urlresolvers import reverse <EOL> from django . conf import settings <EOL> register = template . Library ( ) <EOL> @ register . simple_tag <EOL> def add_paper_url ( content_object ) : <EOL> kwargs = { <EOL> '<STR_LIT>' : ContentType . objects . get_for_model ( content_object ) . id , <EOL> '<STR_LIT>' : getattr ( content_object , '<STR_LIT>' , getattr ( content_object , '<STR_LIT:id>' ) ) , <EOL> } <EOL> return reverse ( '<STR_LIT>' , kwargs = kwargs ) <EOL> @ register . inclusion_tag ( "<STR_LIT>" , takes_context = True ) <EOL> def paper_preview ( context , paper ) : <EOL> return { '<STR_LIT>' : paper , '<STR_LIT>' : context [ '<STR_LIT>' ] , '<STR_LIT>' : settings . STATIC_URL } </s>
