Custom include tag
Question: I want to make a custom include tag (like `{% smart_include something %}` ),
which realize what kind a thing we want to include and then call regular `{%
include %}` tag. That's should be something like this:

    
    
    @register.simple_tag
    def smart_include(something):
        if something == "post":
              template_name = "post.html"
              return regular_include_tag(template_name)
    

Is there a way to use `{% include %}` tag in python code, and how exactly?

**UPD.** turn's out, the best way to solve this problem is just use
`render_to_string` shortcut


Answer: If you look into the **django.template.loader_tags** you fill find a function
**do_include** which is basically the function that is called when we use {%
include %}.

So you should be able to import it call the function itself in python.

I have not tried this but I think it should work

