开发者

Django AJAX - suggestions

开发者 https://www.devze.com 2023-04-08 15:53 出处:网络
I have made a functional site with django, but I have two forms which reside in separate pages. Since all the activities of the webapp will be centered around these forms, I want to put them both on t

I have made a functional site with django, but I have two forms which reside in separate pages. Since all the activities of the webapp will be centered around these forms, I want to put them both on the main page, to save space and preseve the "desktop" look and feel.

What would be the correct way to do it with Django?

To call the pages with the forms with Aj开发者_StackOverflow社区ax call (I m thinking jQuery), thus maintaining the views relatively simple, or to merge the main page view with the forms views, which would result in messy code with lots of database hits, maybe unneccesary?


You could do this with Dajax (http://www.dajaxproject.com/), an awesome Django plugin for quick, simple AJAX implementation.

The index page could call a Dajaxice function with a callback javascript method for each of the forms. The Dajaxice function (a python method) would generate the html and the callback javascript method would write it to the screen element associated with that section.

I have a similar case where I have sections of data that all called separately by dajax, to populate a single edit screen.

0

精彩评论

暂无评论...
验证码 换一张
取 消