Skip to content

Add render_block function#60

Merged
clokep merged 11 commits intoclokep:mainfrom
gogognome:59-render-block
May 12, 2025
Merged

Add render_block function#60
clokep merged 11 commits intoclokep:mainfrom
gogognome:59-render-block

Conversation

@gogognome
Copy link
Contributor

This pull request adds the render_block() function that returns an HttpResponse with the block.
It also allows to verify the context that was passed to render_block() in unit tests.

Closes #59

Sander Kooijmans added 4 commits September 26, 2024 17:05
This function returns a response that calls render_block_to_string()
under the hood to generate the content of the response.

(cherry picked from commit 4d9297e)
(cherry picked from commit e46abe5)
Because render_block() must be called from view code, the settings have been
changed for the tests to include a "tests" app, with a single URL and a single
View class.

(cherry picked from commit 1e1683a)
This is more in sync with the rest of the project and is a bit easier to
understand.

(cherry picked from commit 97819c4)
@gogognome gogognome requested a review from clokep as a code owner September 26, 2024 15:09
@gogognome
Copy link
Contributor Author

This is my first pull request ever, so I might need some help with Github. It seems I created a new issue, but this pull request is intended to fix #59.

@gogognome
Copy link
Contributor Author

gogognome commented Sep 30, 2024

I figured out how to run the build steps locally on my computer, so I could fix the linter errors. My branch now locally passes the CI steps.

@robertpro
Copy link

@clokep any change this gets merged?

@clokep
Copy link
Owner

clokep commented May 9, 2025

Sorry for the delay. I pushed a bunch of changes which heavily simplifies the code. If we want something similar to TemplateResponse, that's best done as a separate PR.

@clokep clokep merged commit ae6890d into clokep:main May 12, 2025
6 checks passed
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

Successfully merging this pull request may close these issues.

What do you think of from render_block import render_block_to_response?

3 participants