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.

PyAMF and django ForeignKey的更多相关文章

  1. Django ForeignKey不需要参照完整性?

    我想在django模型中设置一个ForeignKey字段,它在某些时候指向另一个表.但我希望可以在这个字段中插入一个id,它引用另一个表中可能不存在的条目.因此,如果该行存在于另一个表中,我希望获得F ...

  2. django ForeignKey ManyToMany 前后端联动

    总结 外键基本和普通的字段是一样的 多对多 获取 getlist() 更新 clear() add() remove() 前端和后端是通过字符串沟通的,所以使用ajax的时候如果是数据类型,记得要JS ...

  3. 【Python】Django数据模型、级联删除、级联更新、ER图导出等

    在本文中,我们将向读者详细介绍如何在更新和删除父表数据的同时,触发有关子表数据的级联更新和删除操作.您将看到当使用InnoDB表的时候,借助于外键约束就可以轻松搞定这一过程. 一.利用外键约束更新并删 ...

  4. django博客项目3:创建 Django 博客的数据库模型

    设计博客的数据库表结构 博客最主要的功能就是展示我们写的文章,它需要从某个地方获取博客文章数据才能把文章展示出来,通常来说这个地方就是数据库.我们把写好的文章永久地保存在数据库里,当用户访问我们的博客 ...

  5. [python][django学习篇][3]创建django web的数据库模型

    推荐学习博客:http://pythonzh.cn/post/8/ 博客或者web界面向用户展示内容,它需要从某个地方获取博客内容或者web界面内容,才能够展示出来.通常来说:某个地方指的就是数据库 ...

  6. django : related_name and related_query_name

    This post is about two Django ForeignKey parameters related_name related_query_name See an example b ...

  7. HelloDjango 系列教程:创建 Django 博客的数据库模型

    文中涉及的示例代码,已同步更新到 HelloGitHub-Team 仓库 设计博客的数据库表结构 博客最主要的功能就是展示我们写的文章,它需要从某个地方获取博客文章数据才能把文章展示出来,通常来说这个 ...

  8. Django 之 ForeignKey、ManyToMany的访问方式

    1.ForeignKey 情况I: from django.db import models class Blog(models.Model): pass class Entry(models.Mod ...

  9. Django 学习笔记之五 Django中数据库中ManyToManyField及ForeignKey

    1.model里面的代码: from __future__ import unicode_literalsimport django.utils.timezone as timezonefrom dj ...

随机推荐

  1. Cento OS 6.5 YUM 安装 R 的方法

    (1)配置yum (2)安装EPEL YUM源 yum install  epel-release 修改源配置文件/etc/yum.repos.d/epel.repo ,把基础的恢复,镜像的地址注释掉 ...

  2. iOS开发---百度地图配置流程,2.6.0 版本 支持64位

      1.首先需要在百度地图下载最新SDK:地址: http://developer.baidu.com/map/index.php?title=iossdk/sdkiosdev-download 2. ...

  3. iOS开发——高级技术&调用地图功能的实现

    调用地图功能的实现 一:苹果自带地图 学习如逆水行舟,不进则退.古人告诉我们要不断的反思和总结,日思则日精,月思则月精,年思则年精.只有不断的尝试和总结,才能让我们的工作和生活更加 轻松愉快和美好.连 ...

  4. 从零开始学Bootstrap(3)

    首先让我们回顾一下系列内容. 从零开始学Bootstrap(1)介绍了BootStrap最简单的模板,逐条解释了每行代码的含义. 从零开始学Bootstrap(2)强调了边学边做,通过实际的例子,讲解 ...

  5. 删除配置文件解决OS X各种WiFi无法连接的顽固问题,解决MAC无法连接wif的情况 Preferences

    删除配置文件解决OS X各种WiFi无法连接的顽固问题 删除配置文件解决OS X各种WiFi无法连接的顽固问题1 记住现在wifi的密码并将wifi关闭2 前往文件夹/Library/Preferen ...

  6. ARM Cortex Debug Port Access Port DP AP JTAG-DP SW-DP SWJ-DP JTAG-AP MEM-AP

  7. MySQL查询及删除重复记录的方法

    查询及删除重复记录的方法(一)1.查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断select * from peoplewhere peopleId in (select p ...

  8. Backbone.js Wine Cellar 教程

    中文版: http://rd.189works.com/article-74541-1.html http://www.189works.com/article-74542-1.html http:/ ...

  9. linux centos java 应用服务器配置

    备忘: https://oneinstack.com/ 1.用root装jdk nginx.tomcat. 2.配置tomcat主机,上传应用.修改数据库连接帐号,修改log4j文件路径.3.安装my ...

  10. MySQL的慢查询分析

    慢查询分析日最初是用来捕获比较“慢”的查询,在mysql5.1 + 版本中,慢查询的功能被加强,可以通过设置long_query_time为0来捕获所有的查询,而且查询的响应时间已经可以做到微妙级别. ...