• Home
  • About

thougths.as_blog()

code and sports

Feed on
Posts
Comments

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.

Posted in programming, django, helpers, AJAX, prototype | No Comments

Comments are closed.

  • Recent Posts

    • 23
    • helpers sample project
    • AJAX.Update and Django errors
    • Django helpers on Google code
    • link_to_remote vs remote_function
    • quick rails style helper
  • Archives

    • June 2007 (3)
    • May 2007 (6)
    • November 2006 (2)
  • Categories

    • Uncategorized (1)
    • programming (10)
      • django (10)
        • helpers (8)
      • javascript (3)
        • AJAX (5)
          • prototype (5)
  • Pages

    • About

thougths.as_blog() © 2008 All Rights Reserved.

MistyLook made free by Web Hosting Bluebook