class Town (models.Model):
name = models.CharField (max_length = 150,
verbose_name = _("Human settlement name"),
)
ref_town = models.ForeignKey ('self',
blank = True,
null = True,
verbose_name = _("Superior human settlement"),
help_text = _("Superior human settlement name (for subordinate settlements)"),
)
class CoalMine (models.Model):
name = models.CharField (max_length = 150,
verbose_name = _("Coal mine"),
help_text = _("Coal mine name"))
town = models.ForeignKey (Town,
default = 1,
verbose_name = _("town"))
我的数据中有很多城镇,我需要过滤那些与煤矿无关的城镇。有没有解决方案?