Traversing Models does not work in Forms

In models.py, I have the following two models:

class Gap_Add(models.Model):
    dos = models.DateField()
    tin = models.CharField(max_length=50, null=True, blank=True)
    npi = models.CharField(max_length=50, null=True, blank=True)
    provider_name = models.CharField(max_length=250, null=True, blank=True)
    medical_group = models.CharField(max_length=250, null=True, blank=True)
    icd_code = models.ForeignKey(ICD_Code, on_delete=models.CASCADE)
    note = models.TextField(default='', null=True, blank=True)
    reviewer = models.ForeignKey(Gap_User, on_delete=models.CASCADE)
    datetime = models.DateTimeField(auto_now_add=True)
    chart = models.ForeignKey(Chart, on_delete=models.CASCADE, null=True, blank=True)
    
class Gap(models.Model):

    class Outcome(models.IntegerChoices):
        NOT_REVIEWED = 0, "Not Reviewed"
        SUPPORTED = 1, "Supported"
        NOT_SUPPORTED = 2, "Not Supported"
        
    member = models.ForeignKey(Member, on_delete=models.CASCADE)
    hcc = models.ForeignKey(HCC, on_delete=models.CASCADE)
    latest_doc_date = models.DateField()
    source = models.ForeignKey(Source, on_delete=models.CASCADE)
    outcome = models.PositiveSmallIntegerField(choices=Outcome.choices, default=Outcome.NOT_REVIEWED)
    icd_code = models.ManyToManyField('ICD_Code')
    gap_add = models.ForeignKey(Gap_Add, on_delete=models.CASCADE, null=True)

in forms.py, I have the following code:

class Gap_Add_Form(ModelForm):
    class Meta:
        model = Gap
        fields = ['hcc', 'latest_doc_date', 'gap_add__dos'] 

I get the following error:

django.core.exceptions.FieldError: Unknown field(s) (gap_add__dos) specified for Gap

Whey is it that I can’t traverse from the Gap model to the Gap_App model?

Because it’s a ModelForm for the Gap model. You can’t include fields from a different model.

If you want to have fields from two models in what looks like a single form on the page you would use two ModelForms.

There are some links in this answer that should help Multiple Models to one Form - #2 by KenWhitesell