考慮: from django.db import models
class Food(models.Model):
"""Food, by name."""
name = models.CharField(max_length=25)
class Cat(models.Model):
"""A cat eats one type of food"""
限制外國鍵選擇應用到相關對象我有類似以下 class Parent(models.Model):
name = models.CharField(max_length=255)
favoritechild = models.ForeignKey("Child", blank=True, null=True)
class Child(models.Model):
n