django之关联field 描述子
"""
Accessors for related objects.
When a field defines a relation between two models, each model class provides
an attribute to access related instances of the other model class (unless the
reverse accessor has been disabled with related_name='+').
Accessors are implemented as descriptors in order to customize access and
assignment. This module defines the descriptor classes.
Forward accessors follow foreign keys. Reverse accessors trace them back. For
example, with the following models::
class Parent(Model):
        pass
class Child(Model):
        parent = ForeignKey(Parent, related_name='children')
``child.parent`` is a forward many-to-one relation. ``parent.children`` is a
reverse many-to-one relation.
There are three types of relations (many-to-one, one-to-one, and many-to-many)
and two directions (forward and reverse) for a total of six combinations.
1. Related instance on the forward side of a many-to-one or one-to-one
   relation: ``ForwardManyToOneDescriptor``.
Uniqueness of foreign key values is irrelevant to accessing the related
   instance, making the many-to-one and one-to-one cases identical as far as
   the descriptor is concerned. The constraint is checked upstream (unicity
   validation in forms) or downstream (unique indexes in the database).
If you're looking for ``ForwardOneToOneDescriptor``, use
   ``ForwardManyToOneDescriptor`` instead.
2. Related instance on the reverse side of a one-to-one relation:
   ``ReverseOneToOneDescriptor``.
One-to-one relations are asymmetrical, despite the apparent symmetry of the
   name, because they're implemented in the database with a foreign key from
   one table to another. As a consequence ``ReverseOneToOneDescriptor`` is
   slightly different from ``ForwardManyToOneDescriptor``.
3. Related objects manager for related instances on the reverse side of a
   many-to-one relation: ``ReverseManyToOneDescriptor``.
Unlike the previous two classes, this one provides access to a collection
   of objects. It returns a manager rather than an instance.
4. Related objects manager for related instances on the forward or reverse
   sides of a many-to-many relation: ``ManyToManyDescriptor``.
Many-to-many relations are symmetrical. The syntax of Django models
   requires declaring them on one side but that's an implementation detail.
   They could be declared on the other side without any change in behavior.
   Therefore the forward and reverse descriptors can be the same.
If you're looking for ``ForwardManyToManyDescriptor`` or
   ``ReverseManyToManyDescriptor``, use ``ManyToManyDescriptor`` instead.
"""
django之关联field 描述子的更多相关文章
- django之关联field 描述子是如何实现的
		model定义时,每个field都是一个类属性,一个对象.在生成类时,属性有contribute_to_class的方法,会调用该方法. m2m field,它会先调用自己的contribute_to ... 
- django之relacted.py(探秘django的关联field)
		生成model类对象时,传入的每个field对象都会调用其contribute_to_class函数,生成对应的属性. def contribute_to_class(self, cls, name, ... 
- django自关联,auth模块
		一.自关联 写蛮好的一篇博客:https://www.cnblogs.com/Kingfan1993/p/9936541.html 1.一对多关联 1.表内自关联是指表内数据相关联的对象和表是相同字段 ... 
- BRIEF 特征描述子
		Binary Robust Independent Elementary Features www.cnblogs.com/ronny 1. BRIEF的基本原理 我们已经知道SIFT特征采用了128 ... 
- 基于HOG-3D的时空描述子
		作者提出一种新的基于局部描述子的行为识别算法. 
- Brief描述子
		一.Brief算法 1.基本原理 BRIEF是2010年的一篇名为<BRIEF:Binary Robust Independent Elementary Features>的文章中提出,B ... 
- SIFT算法:特征描述子
		SIFT算法:DoG尺度空间生产 SIFT算法:KeyPoint找寻.定位与优化 SIFT算法:确定特征点方向 SIFT算法:特征描述子 目录: 1.确定描述子采样区域 2.生成描述子 2.1 旋 ... 
- SIFT解析(三)生成特征描述子
		以上两篇文章中检测在DOG空间中稳定的特征点,lowe已经提到这些特征点是比Harris角点等特征还要稳定的特征.下一步骤我们要考虑的就是如何去很好地描述这些DOG特征点. 下面好好说说如何来描述这些 ... 
- (二)ORB描述子提取源码思路与实现
		ORBSLAM2中ORB特征提取的特点 ORBSLAM2中通过对OpenCV中的ORB特征点提取类进行修改,对图像进行分块提取,而后划分节点,使得每个节点中保存的特征点性能是该节点所有特征点中最好的. ... 
随机推荐
- less的安装和使用
			资料: https://www.cnblogs.com/starof/p/5226739.html 
- Ubuntu中,wxpython的TextCtrl引发的error:_pixman_log_error
			1>在windows下,执行下面的代码,不会报错,但是在Ubuntu下,就会报错 2>在Ubuntu下执行上面的代码,会提示下面的错. 解决方法: 若是TextCtrl中不写wx.TE_M ... 
- Android Studio学习之build.gradle文件
			参考书籍:第一行代码 最外层目录下的build.gradle buildscript{repositories{ jcenter() //代码托管仓库 } dependencies{ classpat ... 
- Git与Github的连接与使用
			下面继续,使用git 将项目上传到GitHub上 首先要有GitHub账号,这就不用说了,没有的先注册,地址:https://github.com 没有仓库的话,先新创建一个仓库 填写新仓库名称,备注 ... 
- day-07数据类型转换与字符编码
			类型转换 1.字符串转换为数字 res = int('10')print(res)res = int('-3')print(res)res = float('.15')print(res)res = ... 
- C# EnumHelper Enum的值,Description,ToString()的相互转换
			首先定义枚举类型,如下: /// <summary> /// 板块 /// </summary> public enum Plate { [Descriptio ... 
- neo4j通过LOAD CSV导入结点和关系
			1.neo4j默认的导入入口是:安装路径/import,所以要将csv文件放在import目录下,像下面这样: 2.导入后中文乱码: 因为neo4j是utf-8的,而CSV默认保存是ANSI的,需要用 ... 
- js中this最简单清晰的解释
			引自 https://www.cnblogs.com/huangwentian/p/6854472.html#commentform ① this指向的,永远只可能是对象! ② this ... 
- 如何删除Kafka的Topic
			在server.properties文件中添加配置:delete.topic.enable=true 创建kafka主题: kafka-topics.sh --create --zookeeper 1 ... 
- tensorboard  OSError:[Errno 22] Invalid argument
			哈哈 问题解决了.感谢大佬 Bill.Z 附上原文链接:https://blog.csdn.net/u013244846/article/details/88380860 解决方法:更改manager ... 
