Re: django template blocks and jquery

2010-02-17 Thread bruno desthuilliers
On 17 fév, 20:39, Joel Stransky wrote: > Ok thanks. I never actually tried it, just assumed it wouldn't work. I'll > give it a shot next time I run into this. > FWIW, your current solution is IMHO way cleaner (=> more readable, more explicit, and less likely to break if / when something changes

Re: django template blocks and jquery

2010-02-17 Thread Joel Stransky
Ok thanks. I never actually tried it, just assumed it wouldn't work. I'll give it a shot next time I run into this. On Wed, Feb 17, 2010 at 3:49 AM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > > > On Feb 16, 10:50 pm, Joel Stransky wrote: > > That was my first thought too David

Re: django template blocks and jquery

2010-02-17 Thread bruno desthuilliers
On Feb 16, 10:50 pm, Joel Stransky wrote: > That was my first thought too David but the %} both closes the js method > declaration and causes a syntax error. It shouldn't - unless you try to display the unrendered template in your browser, of course. -- You received this message because you a

Re: django template blocks and jquery

2010-02-16 Thread Joel Stransky
That was my first thought too David but the %} both closes the js method declaration and causes a syntax error. Turns out however that you can have more than 1 domready function so I just enclosed the global ones in a new .js file and appended a completely new $(document).ready() function in the ch

Re: django template blocks and jquery

2010-02-16 Thread David Zhou
There are a couple of ways, but here's one off the top of my head: Base template: $(function(){ function1() { ... } function2() { ... } {% block additional_domready %}{% endblock %} }); {% block additional_js }%}{% endblock %} child template that extends base template: {% block add

django template blocks and jquery

2010-02-16 Thread Joel Stransky
Still very new to django so excuse the newbish questions. This might be obvious but I need a smart solution. I have a template that runs a jquery function at document ready which defines a few other functions. I only need a couple of these functions in the template I'm extending, the other I need