﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20662	Embedding views in templates	Mehran Kholdi <semekh.dev@…>	nobody	"I think there is a common need to use reuse logic-backed data in multiple places (e.g. latest comments box in a blogging app)

While [[https://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-context-requestcontext|RequestContext]]s may work in [[http://www.djangobook.com/en/2.0/chapter09.html#requestcontext-and-context-processors|some]] cases , it may not be the right-by-design solution for a bit more complex ones.

A well-known solution among django community is use of `templatetag`s: (e.g. [[http://stackoverflow.com/questions/1691400/how-to-implement-symfony-partials-or-components-in-django|QA1]], [[http://stackoverflow.com/questions/2922145/php-symfony-view-component-analog-in-python-django|QA2]])
But regarding the NIH-syndrome I don't think it would be a good idea to invent yet-another-templatetag for each embedded view, which I've already seen it in many projects.

I suppose having a `render_view` templatetag in core would both increase code reuse and readability. See [[http://symfony.com/doc/current/book/templating.html#embedding-controllers|Symfony2]] for an equivalent approach.

The implementation would be pretty straightforward, with a new `simple_tag` forwarding calls to appropriate view. A bonus would be the ability provide ajax-based partial contents."	New feature	closed	Template system	dev	Normal	invalid		semekh.dev@…	Unreviewed	0	0	0	0	0	0
