Zapisuje modele do fixtur... nastepnie te fixtury staram sie załadować w testach i otrzymuje następujący błąd:
django.db.utils.IntegrityError: Problem installing fixtures: The row in table 'monkeyShop_shopuser' with primary key '26' has an invalid foreign key: monkeyShop_shopuser.user_ptr_id contains a value '26' that does not have a corresponding value in auth_user.id.
Mam taki model dziedziczący po Userze.... i to on zwraca błąd. Ma ktoś jakis pomysl?
class ShopUser(User):
address = models.CharField(max_length=1000, blank=True)
postCode = models.CharField(max_length=1000, blank=True)
city = models.CharField(max_length=1000, blank=True)
phoneNumber = models.CharField(max_length=20, blank=True)
cart = models.ForeignKey(Cart, on_delete=models.CASCADE, related_name="customer", blank=True, null=True)
def save(self, *args, **kwargs):
self.username = self.email
super(ShopUser, self).save()