I have two models:
我有两个型号:
class Profile(models.Model):
user = models.OneToOneField(User, null=True)
address = models.CharField(max_length=500)
def pets(self):
return Pet.objects.filter(owner=self.id)
class Pet(models.Model):
owner = models.ForeignKey(Profile)
name = models.CharField(max_length=150)
class Profile(mo