IntegrityError: wartość null w kolumnie „city_id” narusza ograniczenie niezerowe
I dwa model:
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)
kiedy synchronizuję i tworzę użytkownika admin:
IntegrityError: null value in column "city_id" violates not-null constraint
Jak mogę naprawić ten błąd?