<s> from django . contrib . auth . models import User <EOL> from django import template <EOL> from actstream . models import Follow <EOL> register = template . Library ( ) <EOL> @ register . filter <EOL> def followers ( username ) : <EOL> try : <EOL> user = User . objects . get ( username = username ) <EOL> except User . DoesNotExist : <EOL> raise template . TemplateSyntaxError ( "<STR_LIT>" % username ) <EOL> return len ( Follow . objects . followers ( user ) ) <EOL> @ register . filter <EOL> def following ( username ) : <EOL> try : <EOL> user = User . objects . get ( username = username ) <EOL> except User . DoesNotExist : <EOL> raise template . TemplateSyntaxError ( "<STR_LIT>" % username ) <EOL> return len ( Follow . objects . following ( user ) ) </s>
