我有下面的模型,我如何获得给定的邮政编码city id
?
from django.db import models
class City(models.Model):
# ...
pass
class Location(models.Model):
# ...
city= models.ForeignKey(City)
class Postcode(models.Model):
# ...
location = models.ForeignKey(Location)
postcode = models.CharField(max_length=10)