Skip to content

Extend template context in TemplateHTMLRenderer #8569

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

Closed
wants to merge 2 commits into from

Conversation

mymedia2
Copy link

Not sure the patch series fit all cases but works for me.

Relates: #8568
Closes: #5236

mymedia2 added 2 commits July 19, 2022 12:42
 * Pass data as a whole.
 * Pass processing response.
 * Pass current view.
 * Request is always available in Django templates.

Actually, the data can be accessed trough the response, the request and
the response trough the view.
Provide an example demonstrating this renderer can now be interoperable
with JSONRenderer.
@stale
Copy link

stale bot commented Sep 20, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 20, 2022
@tofu-rocketry
Copy link
Contributor

Any maintainers able to look at this?

@tomchristie
Copy link
Member

Thanks for your time on this - I've made a comment against the issue... #5236 (comment) describing what change I'd expect to see.

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the following suggestion from Tomchristie

Okay, so #8569 changes the behaviour more than I'd like.
I'd suggest we aim to keep things absolutely as minimal as possible here, so...

Add a test case that demonstrates the issue.
Change TemplateHTMLRenderer so that when data is a list, not a dict/dict-like then it is returned under a {"results": data} key. This has the advantage of being compatible with paginated results.

@stale
Copy link

stale bot commented Jan 21, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 21, 2023
@auvipy auvipy removed the stale label Mar 25, 2023
@stale
Copy link

stale bot commented Jun 12, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TemplateHTMLRenderer - TypeError - context must be a dict rather than ReturnList.
4 participants