Django.db.utils.IntegrityError: The row in table 'accountss_comments' with primary key '10' has an invalid foreign key

I'm trying to make the patient give a review and a rate but this error pop up when I run migrate

the error is

django.db.utils.IntegrityError: The row in table 'accountss_comments' with primary key '10' has an invalid foreign key: accountss_comments.doctore_id contains a value '1' that does not have a corresponding value in accountss_doctor.user_id.

this my models


class User(AbstractUser):
    is_doctor = models.BooleanField(default=False)
    is_patient = models.BooleanField(default=False)


class Doctor(models.Model):
    user = models.OneToOneField(
        User, on_delete=models.CASCADE, primary_key=True)
    number_phone = models.CharField(
        _('االهاتف :'), max_length=50, blank=True, null=True)

class Patient(models.Model):
    user = models.OneToOneField(
        User, on_delete=models.CASCADE, primary_key=True)
    name = models.CharField(max_length=50, verbose_name="الاسم ")



class Comments(models.Model):
    created_by = models.ForeignKey(
        Patient, on_delete=models.CASCADE)
    doctore = models.ForeignKey(
        Doctor, on_delete=models.CASCADE, related_name='comments')
    # co_email = models.ForeignKey(
    #     User, on_delete=models.CASCADE, related_name='comment')
    co_body = models.TextField(max_length=400, verbose_name='التعليق')
    rate = models.IntegerField(default=0)
    created_dt = models.DateTimeField(auto_now_add=True)
    active = models.BooleanField(default=True)

please if there is any solution write below and explain it because I'm still new to Django I tried so hard to fix but with no result

Back to Top