Django + GWT或Jquery [英] Django + GWT or Jquery

查看:131
本文介绍了Django + GWT或Jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在django中做了一个复杂的模型结构。我已经计划使用GWT渲染这个结构,但是使用python来选择传达白名单,它是:
- 使用JSON,在这种情况下,我必须复制javascript对象中的模型结构(参见gwt教程)。
- python-gwt-rpc是一个与gwt兼容的远程过程调用库,但在我看来,与django模型集成并不容易,而且过时的文档不能帮助我。



我考虑的另一种方法是使用Django模板系统来渲染我的页面,使用一些Jquery UI插件,并且在这个 post 来搜索html数据而不处理JSON对象,因为我认为处理它这是一个噩梦,因为在我的结构中,当数据发生变化时,界面可能会被恶意更改。



所以我认为使用GWT我必须在javascript对象中复制django模型但是我已经支持java子类系统了。在第二个解决方案中,我重新使用django模型,并使用django模板系统,然后我可以使服务器端检查,但既不是一个很酷的GWT接口也不是轻量级Json调用更新页面。



在这个问题上,yuor方法是什么?

解决方案

你是否考虑过睡衣?



对我来说,这是两个世界的最好的。您像往常一样使用Django后端,但可以轻松地使用您的睡衣代码中的JSON RPC服务。



您的代码很像在GWT中,但是在Python而不是Java中。



这是一个简短的教程: http://gdwarner.blogspot.com/2008/10/brief-pyjamas-django-tutorial.html


I have made a complex models structure in django. I had planned to render this structure using GWT, but with python the option to communicate whit it are: - using JSON and in this case I have to duplicate the models structure in javascript objects (see gwt tutorial). - python-gwt-rpc is a remote procedure call library compatible with gwt, but it seems to me that it's not easy to integrate with django models, and the outdated documentation doesn't help me.

The alternative I considering is using the Django template system to render my pages with some Jquery UI plugins and the method suggested in this post to retriving html data without deal with JSON objects because I think that dealing with it is a nightmare because in my structure when the data changes also the interface could be drammatically change.

So I think that with GWT I have to duplicate the django models in javascript objects but I have supported by the java subclasses system. In the second solution I reuse the django models and use the django template system then I able to make server side check, but neither a cool GWT interface neither the lightweight Json call to update pages.

What is yuor approach on this issue?

解决方案

Have you considered pyjamas?

For me, it's the best of both worlds. You use, as usual, the Django back-end but can easily use JSON RPC services from your pyjamas code.

You code the front-end pretty much like in GWT, but in Python instead of Java.

Here is a brief tutorial: http://gdwarner.blogspot.com/2008/10/brief-pyjamas-django-tutorial.html

这篇关于Django + GWT或Jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆