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

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

问题描述

我在 Django 中做了一个复杂的模型结构.我曾计划使用 GWT 渲染此结构,但使用 python 进行通信的选项是:- 使用 JSON,在这种情况下,我必须在 javascript 对象中复制模型结构(请参阅 gwt 教程).- python-gwt-rpc是一个兼容gwt的远程过程调用库,但在我看来与django模型集成并不容易,过时的文档对我没有帮助.

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.

我考虑的替代方案是使用 Django 模板系统来呈现我的页面,其中包含一些 Jquery UI 插件和此 post 以在不处理 JSON 对象的情况下检索 html 数据,因为我认为处理它是一场噩梦,因为在我的结构中当数据发生变化时,界面也会发生戏剧性的变化.

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.

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

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?

推荐答案

你考虑过睡衣吗?

对我来说,这是两全其美的.您像往常一样使用 Django 后端,但可以从睡衣代码轻松使用 JSON RPC 服务.

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.

您编写前端代码的方式与 GWT 非常相似,但使用的是 Python 而不是 Java.

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

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

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

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