def template_callable(func): class GetAttrCaller(object): def __init__(self, instance): self.instance = instance def __getattr__(self, name): return func(self.instance, name) # Would cause Django to think this is a method, even through templates #def __call__(self, *args, **kwargs): # return func(self, *args, **kwargs) class TemplateCallableDescriptor(object): def __get__(self, instance, klass): return GetAttrCaller(instance) return TemplateCallableDescriptor()