Jacob Kaplan-Moss wrote:

On Dec 31, 2005, at 11:02 AM, Michael Hipp wrote:

How do I put multiple apps on one page/template?

Just use both apps in the same view::

    from django.models.polls import polls
    from django.models.blogs import entries

    def my_view(request):
        return render_to_response("template_name", {
            "poll_list" : polls.get_list(),
            "entry_list" : entries.get_list(),
        }

Thanks. But isn't this going to violate the DRY principle?

I'm thinking of the example where I have things that I want to appear around the perimeter of every page on my site representing the output of numerous independent apps. This would seem to leave me with two choices:

1) Replicate the same code across a lot of different views in different apps.

2) Built a mega-view that is called for every url pattern in which it is decoded what was really requested and then calls the various views.

Neither of those sound like good options.

Any insight appreciated,
Michael


Reply via email to