#NEWLINE# def has_permission( self , request , view ) : #NEWLINE# #INDENT# assert ( self . model_cls is not None ) , ( 'Cannot apply %s directly. You must subclass it and override the `parent_model_cls` attribute.' % self . __class__ . __name__ ) #NEWLINE# model_cls = self . model_cls #NEWLINE# if getattr ( view , '_ignore_model_permissions' , False ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# perms = self . get_required_permissions ( request . method , model_cls ) #NEWLINE# return ( request . user and ( request . user . is_authenticated ( ) or ( not self . authenticated_users_only ) ) and request . user . has_perms ( perms ) )