<s> from django import template <EOL> register = template . Library ( ) <EOL> @ register . filter ( name = '<STR_LIT>' ) <EOL> def add_attributes ( field , css ) : <EOL> attrs = { } <EOL> definition = css . split ( '<STR_LIT:U+002C>' ) <EOL> for d in definition : <EOL> if '<STR_LIT::>' not in d : <EOL> attrs [ '<STR_LIT:class>' ] = d <EOL> else : <EOL> t , v = d . split ( '<STR_LIT::>' ) <EOL> attrs [ t ] = v <EOL> return field . as_widget ( attrs = attrs ) <EOL> @ register . filter ( '<STR_LIT>' ) <EOL> def fieltype ( field ) : <EOL> return field . field . widget . __class__ . __name__ </s>
