def finder(finder_cls):
    def decorator(view_func):
        finder = finder_cls()

        @wraps(view_func)
        def _wrapped_view(request, *args, **kwargs):
            if request.is_ajax() and request.GET.get("finder"):
                col_name = request.GET["col"]
                return render(
                    request,
                    finder.column_template(col_name),
                    {
                        "colname": col_name,
                        "finder": {
                            "finder": finder,
                            col_name: finder.objects(
                                col_name, request.GET["id"])
                            },
                        }
                    )
            response = view_func(request, *args, **kwargs)
            try:
                ctx = response.context_data
            except AttributeError:
                return response
            top_col = finder.columns[0]
            finder_ctx = ctx.setdefault("finder", {})
            finder_ctx.update(
                {
                    "finder": finder,
                    top_col.name: finder.objects(top_col.name)
                    }
                )
            return response

        return _wrapped_view

    return decorator
View decorator that takes care of everything needed to render a finder on
dataset/ETHPy150Open mozilla/moztrap/moztrap/view/lists/finder.py/finder