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

Robert Gravina rg at digitaleskimo.net
Tue Apr 22 19:23:52 EDT 2008


On 23/04/2008, at 7:57 AM, Robert Gravina wrote:

> I'm a little disappointed about using Django now because the  
> community doesn't seem to have the same quality standards as the  
> Zope 3 community does, and when I talk to them about it they don't  
> seem to understand why I feel their API is a mess. I'm also hooked  
> on using interfaces and adapters in my programming (got exposure to  
> them in Twisted) and having a hard time using them in Django - even  
> if I can Django itself doesn't use them anyway.
>

I am trying to use interfaces/adapters as much as I can in Django  
though. I'm collecting interfaces/adapters for core Django classes in  
a "zopeify" Django application.

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.

Robert


More information about the Grok-dev mailing list