<s> from django . contrib import messages <EOL> from braces . views import GroupRequiredMixin <EOL> class MultipleGroupRequiredMixin ( GroupRequiredMixin ) : <EOL> def check_membership ( self , group ) : <EOL> """<STR_LIT>""" <EOL> user_groups = self . request . user . groups . values_list ( "<STR_LIT:name>" , flat = True ) <EOL> if isinstance ( group , ( list , tuple ) ) : <EOL> for req_group in group : <EOL> if req_group in user_groups : <EOL> return True <EOL> is_member = group in user_groups <EOL> if not is_member : <EOL> messages . add_message ( self . request , messages . ERROR , '<STR_LIT>' ) <EOL> return is_member </s>
