<s> from django import template <EOL> from django . utils . safestring import mark_safe <EOL> from expedient . common . permissions . shortcuts import has_permission <EOL> from django . contrib . auth . models import User <EOL> register = template . Library ( ) <EOL> @ register . filter <EOL> def is_super_user ( user ) : <EOL> """<STR_LIT>""" <EOL> isSuperUser = False <EOL> if ( has_permission ( user , User , "<STR_LIT>" ) ) : <EOL> return True <EOL> else : <EOL> return False <EOL> @ register . filter <EOL> def cat ( obj1 , obj2 ) : <EOL> return "<STR_LIT>" % ( obj1 , obj2 ) <EOL> @ register . filter <EOL> def check_in_set ( value , arg ) : <EOL> '''<STR_LIT>''' <EOL> if arg . filter ( pk = value . pk ) . count ( ) : <EOL> return "<STR_LIT>" <EOL> else : <EOL> return "<STR_LIT>" <EOL> @ register . filter <EOL> def is_in_set ( value , arg ) : <EOL> '''<STR_LIT>''' <EOL> if arg . filter ( pk = value . pk ) . count ( ) : <EOL> return True <EOL> else : <EOL> return False <EOL> @ register . filter <EOL> def contains ( value , arg ) : <EOL> '''<STR_LIT>''' <EOL> return arg in value <EOL> @ register . filter <EOL> def get_meta_field ( object , fieldname ) : <EOL> '''<STR_LIT>''' <EOL> return getattr ( object . _meta , fieldname ) <EOL> @ register . filter <EOL> def get_verbose_name ( object ) : <EOL> '''<STR_LIT>''' <EOL> return getattr ( object . _meta , "<STR_LIT>" ) <EOL> @ register . filter <EOL> def get_class_field ( object , fieldname ) : <EOL> '''<STR_LIT>''' <EOL> return getattr ( object . __class__ , fieldname ) <EOL> @ register . filter <EOL> def equals ( object1 , object2 ) : <EOL> return object1 == object2 <EOL> @ register . filter <EOL> def leaf_class_is ( obj , klass ) : <EOL> return ( obj . leaf_name == type ( klass ) . __name__ <EOL> and obj . module_name == type ( klass ) . __module__ ) </s>
