#NEWLINE# def _validate_changeable_challenges( self , msg_ids ) : #NEWLINE# #INDENT# exists_changeable_challenges = False #NEWLINE# cleaned_data = None #NEWLINE# for form in self . forms : #NEWLINE# #INDENT# if ( not hasattr ( form , 'cleaned_data' ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# cleaned_data = form . cleaned_data #NEWLINE# accept_changes = cleaned_data . get ( 'accept_changes' ) #NEWLINE# if ( accept_changes and ( accept_changes is not None ) ) : #NEWLINE# #INDENT# exists_changeable_challenges = True #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if exists_changeable_challenges : #NEWLINE# #INDENT# exists_ask_change_contribution_msg = False #NEWLINE# exists_thanking_change_msg = False #NEWLINE# exists_not_understandable_change_msg = False #NEWLINE# messages = Message . objects . filter ( pk__in = msg_ids ) #NEWLINE# for message in messages : #NEWLINE# #INDENT# if ( message . category == 'ask_change_contribution' ) : #NEWLINE# #INDENT# exists_ask_change_contribution_msg = True #NEWLINE# #UNINDENT# if ( message . category == 'thanks_change' ) : #NEWLINE# #INDENT# exists_thanking_change_msg = True #NEWLINE# #UNINDENT# if ( message . category == 'not_understandable_change_contribution_reply' ) : #NEWLINE# #INDENT# exists_not_understandable_change_msg = True #NEWLINE# #UNINDENT# #UNINDENT# if ( not form ) : #NEWLINE# #INDENT# msg = 'Please include into the list of chosen messages a message to ask a participant whether he/she wants to change his/her contribution.' #NEWLINE# raise forms . ValidationError ( _ ( msg ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not exists_thanking_change_msg ) : #NEWLINE# #INDENT# msg = 'Please include into the list of chosen messages a message to thank participants for their change.' #NEWLINE# raise forms . ValidationError ( _ ( msg ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not exists_not_understandable_change_msg ) : #NEWLINE# #INDENT# msg = 'Please include into the list of chosen messages a message to notify a participant that his/her answers to the request about changing a previous contribution was not understandable.' #NEWLINE# raise forms . ValidationError ( _ ( msg ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return cleaned_data