graphql-python / graphql-python/flask-graphql

Proposal: Pass custom variables to graphiql template

未关闭
#35 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
1.3k
派生
139
PR 合并指标
30 天内没有已合并 PR

描述

Hi !

It would be nice to be able to pass arbitrary variables to the graphiql template. I didn't found how to do it and looking at how `render_graphiql.py` is called, it seems that this is not possible.

I found a workaround by pre-formatting my template before passing it to `GraphQLView.as_view()` but it felt awkward.
Maybe something like this would look nicer:

```python
view_func = GraphQLView.as_view(
url,
schema,
graphiql=True,
graphiql_template=my_custom_template,
graphiql_template_context={"username": username} # Now I can greet the user on my custom page !
)
```

If you guys are interested by this proposal let me know and I'll do a PR in the next few days.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。