Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9109505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:03:34+00:00 2026-06-17T03:03:34+00:00

Business: Practical background for all that is design of web-app, where web-page constructed from

  • 0

Business:

Practical background for all that is design of web-app, where web-page constructed from prototype objects, gadgets, which individually defined each in its own view function (its own code, not necessarily django-view function). And to build a ‘production’ web-page they can be placed in regular view, related to this page, and produce web-page elements according to given source-data and other parameters.
For example I have a chart-gadget, and it receives source data, parameters, about chart-type, beauty/colors etc, and draws a chart. How can it be stored in separate from specific ap, loose-coupled code? Which design-approach is better?

What Ive tried:

Ive tried ‘dumb’ way:

For example I have a simple view:

from django.shortcuts import render_to_response
from django.template import Template, Context
from string import letters
def home(request):
    t = Template("""<ul>
                        {% for key, value in d.items %}
                            <li>{{ key }}: {{ value }}</li>
                        {% endfor %}
                    </ul>""")
    d = {k: v for v, k in enumerate(letters)}
    return render_to_response('home.html', {'t': t, 'd':d})

And template:

<html>
<head>
    <title>Django tests</title>

</head>
<body>
{% include t with d=d %}
</body>
</html>

With such setup I get: TemplateDoesNotExist

Expectations about answer:

Im searching any reasonable scheme for storing chunk of web-page, which designed to kinda live by its own life, less-or-more separately from other elements of web-page, in a similarly separate chunk of code in web-app program backend.
As example I can provide such projects as:

  • iGoogle
  • Netvibes

Thank you!

ps

Extracts from django-docs:

  • Extends:

{% extends variable %} uses the value of variable. If the variable
evaluates to a string, Django will use that string as the name of the
parent template. If the variable evaluates to a Template object,
Django will use that object as the parent template.

So It means, that with {% extends %} tag, operation what Im talking in question is definitely possible.

  • Include:

This example includes the contents of the template whose name is
contained in the variable template_name:

{% include template_name %}

So it probably means, that variable passed to {% include %} can bu just a string with name of file. And if its true, it is clear answer on my question – template defined in variable cannot be included in regular template.
It still slightly ambiguous for me, because in Python word name might be used as synonym of variable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:03:35+00:00Added an answer on June 17, 2026 at 3:03 am

    As someone already mentioned in a comment, you need to just render your template to a string and pass it in to the second template, marking it as a safe string so it isn’t auto-escaped. So, your example would be:

    from django.shortcuts import render_to_response
    from django.template import Template, Context
    from django.utils.safestring import mark_safe
    from string import letters
    def home(request):
        t = Template("""<ul>
                            {% for key, value in d.items %}
                                <li>{{ key }}: {{ value }}</li>
                            {% endfor %}
                        </ul>""")
        c = Context({'d': {k: v for v, k in enumerate(letters)}})
        return render_to_response('home.html', {'t': mark_safe(t.render(c))})
    

    Then, in home.html, render with {{ t }}

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an application that runs in the background from startup to shutdown,
Is it bad practice to use the generated objects from Entity Framework as business
Can any one suggest good resources and practice exercises for Teradata and Business Objects
One business jar which have been developed by us is present in war. but
My business has a .NET web service (not WCF) hosted in IIS on a
For business owners to take control of their business page on Yelp, they register
I have a pre-existing c++ object model which represents the business layer tier of
I am writing a framework that allows your modules to define which JS files
I have a business model called Customer which has many required properties (via DataAnnotations)
I'm a web developer who's working in a new shop with developers from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.