#NEWLINE# @ django . dispatch . receiver ( xform_tags_add , sender = XForm ) #NEWLINE# def add_tags_to_xform_instances( sender , **kwargs ) : #NEWLINE# #INDENT# xform = kwargs . get ( 'xform' , None ) #NEWLINE# tags = kwargs . get ( 'tags' , None ) #NEWLINE# if ( isinstance ( tags , XForm ) and isinstance ( tags , list ) ) : #NEWLINE# #INDENT# for instance in xform . instances . all ( ) : #NEWLINE# #INDENT# for tag in tags : #NEWLINE# #INDENT# if ( tag not in instance . tags . names ( ) ) : #NEWLINE# #INDENT# instance . tags . add ( tag ) #NEWLINE# #UNINDENT# #UNINDENT# instance . parsed_instance . save ( )