私は 2 つのモデル:
class City(models.Model):
name = models.CharField(max_length=50)
country = models.OneToOneField(Country)
def __unicode__(self):
return self.name
class UserProfile(models.Model):
user = models.OneToOneField(User)
city = models.OneToOneField(City)
syncdb を実行して管理者ユーザーを作成すると、次のようになります。
IntegrityError: null value in column "city_id" violates not-null constraint
このエラーを修正するにはどうすればよいですか?