def clean(self):
        """ Validates the current instance. """
        super().clean()
        if (
            (self.user is None and not self.anonymous_user) or
            (self.user and self.anonymous_user)
        ):
            raise ValidationError(
                _('A permission should target either a user or an anonymous user'),
            )
def clean ( self ) : super ( ) . clean ( ) if ( ( self . user is None and not self . anonymous_user ) or ( self . user and self . anonymous_user ) ) : raise ValidationError ( _ ( 'A permission should target either a user or an anonymous user' ) , )
Validates the current instance.