[Grok-dev] Re: A Django-like admin in Grok

Martijn Faassen faassen at startifact.com
Wed Apr 23 07:52:30 EDT 2008


Hi there,

On Wed, Apr 23, 2008 at 1:23 AM, Robert Gravina <rg at digitaleskimo.net> wrote:
[snip]
>  I wrote  a Django template tag to allow you to adapt an object from within
> a Django template. Most of the time this happen in python code, but
> occasionally I need to adapt an object from a template to access an
> attribute/method. From Django templates, you can call object methods but can
> run arbitrary code e.g. adapt an object to an interface.
>
>  So, I have something like this to adapt object instance "article" to an
> zopeify.interfaces.IArchived:
>
>  {% adapt article to zopeify.interfaces.IArchived as archived %}
>
>  Then I can call it like {{archived.getAbsoluteURL}} which returns a URL
> based on a date attribute.

On a slightly unrelated topic:

How hard is it to use Django templating outside of Django? Is it a
seperate library? If so, it wouldn't be too hard to integrate this
into a Grok extension, as we have a pluggable templating language
system. We could throw in this adaptation bit too. :)

I think having this would be great, as I've heard people say good
things about the Django templating language. Having this would also
make it easier for people familiar with Django to learn Grok.

Regards,

Martijn


More information about the Grok-dev mailing list