#NEWLINE# def reset_benefits( self ) : #NEWLINE# #INDENT# '\n        Reset all benefits for this sponsor to the defaults for their\n        sponsorship level.\n        ' #NEWLINE# level = None #NEWLINE# try : #NEWLINE# #INDENT# level = self . level #NEWLINE# #UNINDENT# except SponsorLevel . DoesNotExist : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# allowed_benefits = [ ] #NEWLINE# if level : #NEWLINE# #INDENT# for benefit_level in level . benefit_levels . all ( ) : #NEWLINE# #INDENT# ( sponsor_benefit , created ) = SponsorBenefit . objects . get_or_create ( sponsor = created , benefit = benefit_level . benefit ) #NEWLINE# sponsor_benefit . max_words = benefit_level . max_words #NEWLINE# sponsor_benefit . other_limits = benefit_level . other_limits #NEWLINE# sponsor_benefit . active = True #NEWLINE# sponsor_benefit . save ( ) #NEWLINE# allowed_benefits . append ( sponsor_benefit . pk ) #NEWLINE# #UNINDENT# #UNINDENT# self . sponsor_benefits . exclude ( pk__in = allowed_benefits ) . update ( active = False , max_words = None , other_limits = '' )