models.py
class hotel(models.Model):
hotel_name = models.CharField(max_length=20)
class Sell(models.Model):
hotel = models.ForeignKey("hotel")
sell_text = models.CharField(vmax_length=20)
class Selled(models.Model):
buy_choices = [(data.id, data.sell_text) for data in Sell.objects.filter(Hotel_id=2)]
city = models.IntegerField(choices=city_choices, default=1)
命令./manage.py RUNSERVER
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
,为什么我不能用Hotel_id
用于过滤器
外带Hotel_id
将运行
你试过'schemamigration'吗? –
同样的错误信息出现 – Squallcx