Django how to partial render

xster picture xster · Apr 20, 2011 · Viewed 33.5k times · Source

How do I call a view method from a template level like partial render in RoR? The problem is perfectly illustrated in this blog. I can use include to include templates in templates but then I would have to match all the variable names across layers of templates. I really would want to include views in templates and decouple layers. The blog was written a year ago. Is there a better solution since?

Thanks

Answer

Alireza Savand picture Alireza Savand · Apr 20, 2011

I think you're looking for {% include '_partial.html' %}.