graphql-python / graphql-python/flask-graphql

Proposal: Pass custom variables to graphiql template

Abierto
#35 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
1.3k
Forks
139
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.