#NEWLINE# def validate( self , data ) : #NEWLINE# #INDENT# if ( ( self . instance is None ) and models . PriceEstimate . objects . filter ( scope = data [ 'scope' ] , year = data [ 'year' ] , month = data [ 'month' ] , is_manually_input = True ) . exists ( ) ) : #NEWLINE# #INDENT# raise serializers . ValidationError ( 'Estimate for given month already exists. Use PATCH request to update it.' ) #NEWLINE# #UNINDENT# return data