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 3942692
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:41:36+00:00 2026-05-20T00:41:36+00:00

Some parts of Django template are kinda widgets 1 , which are implemented using

  • 0

Some parts of Django template are kinda widgets1, which are implemented using template tags and there could be a lot of some of them at the page (depending on session cookies for example)

Approach like this will do if their number is limited:

{% extends "some.html" %}
{% load mywidgets %}

{% block widgets %}
{% if widget1 %} {% widget1 %} {% endif %}
{% if widget2 %} {% widget2 %} {% endif %}
...

{% if widgetn %} {% widgetn %} {% endif %}
{% endblock widgets %}

But what if it’s not? How to handle a huge amount of widgets?


1 You can see what I mean at iGoogle 😉

  • 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-05-20T00:41:37+00:00Added an answer on May 20, 2026 at 12:41 am

    I think that these widgets should be some kind of objects, not template tags. Objects that can render them self. Then you can simply store these objects in list and render them in a cycle.

    In view you would initialize those objects by passing request or other required arguments. Widget object would implement __unicode__ method which will render it. Then in template you would render it: {{ widget }}.

    widgets.append( Widget(request) )
    
    --
    
    {% for widget in widgets %}
        {{ widget }}
    {% endfor %}
    

    Your widgets could even be django models. Then you could store settings and relate them to users.

    You might want to check how fein-cms, django-cms implement content placeholders. Any kind of content objects can be associated to placeholder. Content object can render it self, and placeholder just renders collection of them.

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

Sidebar

Related Questions

I have a C# application of which some parts are written using WPF (which
I use some third-party template tags in my Django Application (maintained elsewhere) that return
I have been developing some Django app and there's some duplicated code for different
I am using jinja2 with my django application, I am working on porting some
I have to send some string from Java applet(invoked from template) to my django
We're hosting a django service for some clients using really really poor and intermittent
I have a Django 1.3 app for which I am using South 0.7.3 for
I have just started playing around with django-pagination , which is included in some
I have some parts in my code that look like this: A, B and
How can I select some parts of an matrix and cut the single dimensions?

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.