• PyAMF and django ForeignKey


    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.

  • 相关阅读:
    win2008服务器信任问题
    切换cmd的目录
    c#后的完整cookie
    c#网络编程-第一章
    c#访问mysql数据库
    标准库hashlib模块
    标准库ConfigParser模块
    标准库shutil
    标准库 xml
    标准库shelve
  • 原文地址:https://www.cnblogs.com/BoyeeStudio/p/3166749.html
Copyright © 2020-2023  润新知