惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
Y
Y Combinator Blog
I
InfoQ
美团技术团队
罗磊的独立博客
B
Blog RSS Feed
GbyAI
GbyAI
小众软件
小众软件
IT之家
IT之家
Engineering at Meta
Engineering at Meta
Blog — PlanetScale
Blog — PlanetScale
V
V2EX
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
Jina AI
Jina AI
MyScale Blog
MyScale Blog
博客园 - 聂微东
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss

博客园 - BoyeeStudio

FLEX自定义事件 Flex Array 与 ArrayCollection.转自网络 Django Push HTTP Response to users How to sync your github repository after fork from others'. N年没写博客了,手生锈了,准备再来磨磨! CAsyncSocket,CSocket内幕及其用法 Socket中如何设置连接超时(转载 可能用的到) 最近在我的python博客上花时间! P2P相关软件源代码下载 写个perl程序自动下载《南方周末》(2005年12月最后一期,38版,值得一看) wxWidgets开发工具及Makefile的书写!(待续。。。) 用wxWindows编程 -----第一步!(翻译)(系列1) 编VC网络程序遇到一个问题,原来是少了一个LIB。 如何优化C语言代码(程序员必读) 重温经典排序思想--C语言常用排序全解(转载--值得一看) 常用windows API WAP开发FAQ c++资源之不完全导引(全文) (转载) GNU编码标准
PyAMF and django ForeignKey
BoyeeStudio · 2013-07-02 · via 博客园 - BoyeeStudio

In order to support this, PyAMF needs to provide a synonym mapping between fields. Until then, you could use IExternalizable (although clumsily):

classUserProfile(model.Model):
  user      = models.ForeignKey(User, unique=True)
  blurb     = models.CharField( max_length=200,null=True, blank=True)public= models.BooleanField(default=True)class __amf__:
    external =Truedef __writeamf__(self, output):
    output.writeObject(self.id)
    output.writeObject(self.blurb)
    output.writeObject(self.public)def __readamf__(self, input):self.id = input.readObject()self.blurb = input.readObject()self.public= input.readObject()

With the corresponding Flex code:

[RemoteClass(alias="...")][Bindable]publicclassUserProfileimplementsIExternalizable{publicfunctionUserProfile(){}publicvar id:int;publicvar blurb:String;publicvar _public:Boolean;publicfunction writeExternal(output:IDataOutput){
    output.writeObject(id);
    output.writeObject(blurb);
    output.writeObject(_public);}publicfunction readExternal(input:IDataInput){
    id = input.readObject();
    blurb = input.readObject();
    _public = input.readObject();}}

Note I haven't tested the above code, but should work in principle.

Btw, can you go into greater detail about what was confusing about the documentation? I would love to make that as clear possible for new users.