| 17 | === Concepts |
| 18 | |
| 19 | There are 5 main types of fields: |
| 20 | |
| 21 | ===== Data fields |
| 22 | A data field is any field that has an entry on the database, for example a CharField, BooleanField, a ForeignKey |
| 23 | |
| 24 | |
| 25 | {{{ |
| 26 | class Person(models.Model): |
| 27 | # DATA field |
| 28 | data_abstract = models.CharField(max_length=10) |
| 29 | }}} |
| 30 | |
| 31 | |
| 32 | ===== M2M fields |
| 33 | A M2M field that is defined on the current model |
| 34 | |
| 35 | {{{ |
| 36 | class Person(models.Model): |
| 37 | # M2M fields |
| 38 | friends = models.ManyToManyField('self', related_name='friends', symmetrical=True) |
| 39 | }}} |
| 40 | |
| 41 | |
| 42 | ===== Related Object |
| 43 | A Related Object is a relation from another model (such as a ForeignKey) that points to the current model |
| 44 | |
| 45 | |
| 46 | == Endpoints |