ido.nl.eu.org/django/

Note:
-----
I'm still working on this, but not putting out any more releases.
As far as i know, nobody except me is seriously using this code
and my code has progressed far beyond what is listed on this page.
I've talked to the author of Django Zope Page Templates and will try
to any really usefull patches for the rest of you directly into DPT.

Django Zope Page Templates
==========================

This is an extention to Django Page Templates.
The purpose of which is to provide a way to registrate callable python objects
directly to pagetemplates, so it's automaticly included in the Context of the templates.

Why
===
In Zope one can get very used to using zpt macro's and slot's features extensively.
Since you can specify path expressions like container/get_recent_news in zpt you never
need to wurry about your template finding the correct values to put into the template.

With Django you hand over a Context to your template which must contain all the references
and information needed to render the entire page including expressions used in macros and slots.

An subclassed Context object which is used in the django app can go a long way as a solution to not
have to specify every piece of context information in every view/controller.

This code adds a way, much like django template tags and filters, to registrate any tales compatible
Python object to django page templates, making them availible automicly to all your templates.

Todo
====

Requirements
============
You need to have Zope Page Templates :)
A running django installation and the pagetemplate contribution to django from Django Page Templates Install them by downloading the latest Zope. (Tested with Zope-3.1.0)

Download source:

Django Page Templates (which modifications)

home

Example
=======

        menu.py:
            from django.contrib.pagetempate import zptexport

            ...
            @zptexport
            def get_all_news():
                return NewsItem.objects.all()
            ...

            @zptexport(name="recentNews")
            def get_recent_news():
                return NewsItem.objects.all()[:5]

        standard_template.pt:
            ...
            <div class="recentNews" tal:content="recentNews"></div>
            ...
        

A Django site.