def valid_view(context):
    """
    Prevent adding the global snippet in admin views and in editor view
    """
    view_class = getattr(context['view'], '__class__', None) if context.get(
        'view') else None
    if not view_class or not context.get('request'):
        return False
    request = context.get('request')
    if request:
        match = request.resolver_match
        if match and match.app_name == 'shuup_admin':
            return False
    view_name = getattr(view_class, '__name__', '')
    if view_name == 'EditorView':
        return False
    return True
