<s> from __future__ import unicode_literals <EOL> from ... core . tags . registry import register <EOL> from . models import TopicFavorite <EOL> from . forms import FavoriteForm <EOL> @ register . inclusion_tag ( '<STR_LIT>' ) <EOL> def render_favorite_form ( topic , user , next = None ) : <EOL> try : <EOL> favorite = TopicFavorite . objects . get ( user = user , topic = topic ) <EOL> except TopicFavorite . DoesNotExist : <EOL> favorite = None <EOL> form = FavoriteForm ( ) <EOL> return { '<STR_LIT>' : form , '<STR_LIT>' : topic . pk , '<STR_LIT>' : favorite , '<STR_LIT>' : next } </s>
