quick rails style helper
May 24th, 2007 by viestards
I started to port all helpers stuff to Django, but it’s mainly boring. Then the idea came to me, what if there will be only one (or a little bit more) which handle all calls to webhelpers.
So, there is one function, that can call any Pylons webhelpers prototype function- I called it helper. The idea is that every function is very similar and repeating every function call is turning more into copy/paste. But there is easy with getattr.
Result looks like this:
Generic helper <a href="#" onclick="{% helper function_name:remote_function url:/frets/shell/ update:pongbox success:test_funct() %}; return false;">here</a>
Just put it into your template and create pongbox div.
Templatetag file is available here, it is unclean, because I’m working on it, but it should work. Put into templatetags folder.