Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update how requests are passed to Jinja TemplateResponse #129

Open
helen-m-lin opened this issue Jul 1, 2024 · 0 comments
Open

Update how requests are passed to Jinja TemplateResponse #129

helen-m-lin opened this issue Jul 1, 2024 · 0 comments
Assignees

Comments

@helen-m-lin
Copy link
Contributor

Is your feature request related to a problem? Please describe.
For FastAPI>0.108.0, Starlette>0.29.0, we need to create jinja TemplateResponse with the request as a parameter rather than in the context. Otherwise, there are DeprecationWarnings.

Describe the solution you'd like

  • Provide the request as a parameter rather than in the jinja template context
  • Add a lower bound to the package versions for fastapi and starlette with the current versions.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
docs: https://fastapi.tiangolo.com/advanced/templates/

    return templates.TemplateResponse(
        request=request, name="index.html", context={"example": "example"}
    )

instead of

    return templates.TemplateResponse(
        name="index.html", context={"request": request, "example": "example"}
    )
@jtyoung84 jtyoung84 self-assigned this Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants