#NEWLINE# @ staticmethod #NEWLINE# def generate_choices( choices ) : #NEWLINE# #INDENT# results = [ ] #NEWLINE# for choice in choices : #NEWLINE# #INDENT# ct = ContentType . objects . get_for_model ( choice ) #NEWLINE# if isinstance ( choice , User ) : #NEWLINE# #INDENT# label = ( choice . get_full_name ( ) if choice . get_full_name ( ) else choice ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# label = unicode ( choice ) #NEWLINE# #UNINDENT# results . append ( ( ( '%s,%s' % ( ct . model , choice . pk ) ) , ( '%s' % label ) ) ) #NEWLINE# #UNINDENT# return sorted ( results , key = ( lambda x : x [ 1 ] ) )