i am trying to learn jquery + django so a very easy example would be very useful :)
thx.. ash On Nov 8, 5:52 pm, Brian Costlow <[EMAIL PROTECTED]> wrote: > Just thought I'd pass this along. I've been lurking about learning as > I work on a couple of Django-based projects, and thought it was time > to share something back. > > I've been having a lot of success with this combination in an app I've > been tweaking and extending the past week. > > It's basically a web-based reporting application, reading out of a > MySQL db that's updated by other sources. > > The first version of this, done a couple of years ago in PHP and JS > with no framework, did some AJAXy stuff to update parts of the page > without a full reload. > > Version 2 was redone in Django, but the AJAX updates were still hand- > coded JS. (Django's serializer was used to return JSON for the > updates). > > After hearing Simon talk about jquery at OSCON, the next time I needed > to make substantial changes, I redid the JS part in jquery, which made > extending the app with additional reports much simpler. The only > problem was, parts of the pages had two different sets of code that > fetched data from the view and formatted the content. On load of the > full page, a Django template was rendered, on the updates, JSON was > returned and jquery interpreted the result to modify the DOM. As the > design evolved, we had to make sure both parts stayed in sync. > > I was about to go for pass three, in which the page load didn't fetch > all of the database data, and all of the AJAX updated content, even on > initial load, was handled by JSON serializer and jquery. > > But I stumbled across the Taconite jquery plug-in. This allows you to > return an xml file from any jquery AJAX call. The plugin will iterate > over the XML and make DOM changes, abstracting away the need to define > callbacks to do these kind of updates. > > By using Taconite, I was able to rework our Django templates, with > careful use of inheritance and includes, so that I could pass in the > same context, and use the template 'reportn.html' to render a page for > the browser or 'reportn.xml' to render xml for Taconite. So now, when > I get told, for example, to add a column of data to one of the > reports, I can make the change in a single Django template file, and > if necessary, modify a single view function. It's an internal app, and > my employer won't let me post any code, but if anyone is interested in > this approach, I can work up a simple example and post it. > > Info on the plug-in is here: > > http://www.malsup.com/jquery/taconite/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---