Fetching data using Foreign key

How do i retrieve Course objects using semId as the search key…
Also using filter gives empty queryset…TIA

models.py

class Semester(models.Model):
    semId=models.IntegerField(unique=True)
    session=models.DecimalField(max_digits=4,decimal_places=0,null=True)
    def __str__(self):
        return str(self.semId)
class Course(models.Model):
    course=models.Manager()
    semester=models.ForeignKey(Semester,on_delete=models.CASCADE,null=True)
    courseName=models.CharField(max_length=100)
    courseId=models.IntegerField(unique=True)
    student=models.ManyToManyField(Student)
    def __str__(self):
        return str(self.courseName)

views.py

def sem(request,id):
    ob=Course.course.get(semester=id)
    for o in ob:
        print(o.semester)
    return render(request,'sem.html')

Error using get

DoesNotExist at /sem/8/
Course matching query does not exist.
Request Method:	GET
Request URL:	http://127.0.0.1:8000/sem/8/
Django Version:	4.1.1
Exception Type:	DoesNotExist
Exception Value:	
Course matching query does not exist.
Exception Location:	C:\Users\ASUS\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\models\query.py, line 650, in get
Raised during:	emnei.views.sem
Python Executable:	C:\Users\ASUS\AppData\Local\Programs\Python\Python310\python.exe
Python Version:	3.10.7
Python Path:	
['C:\\Users\\ASUS\\Dropbox\\PC\\Downloads\\dd\\project_2\\project\\uosmoy',
 'C:\\Users\\ASUS\\AppData\\Local\\Programs\\Python\\Python310\\python310.zip',
 'C:\\Users\\ASUS\\AppData\\Local\\Programs\\Python\\Python310\\DLLs',
 'C:\\Users\\ASUS\\AppData\\Local\\Programs\\Python\\Python310\\lib',
 'C:\\Users\\ASUS\\AppData\\Local\\Programs\\Python\\Python310',
 'C:\\Users\\ASUS\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages']
Server time:	Sat, 17 Sep 2022 12:24:47 +0000

See Making queries | Django documentation | Django

If a filter function is returning an empty queryset, then either you don’t have the data in your database that you think is there, or you’ve written your query incorrectly.

(Note: If you’re getting an error message - which I believe you may be - it’s always helpful to include the complete error in your posts.)

updated the error message.
Also using filter returns empty queryset…
I guess the thing i am missing here is accessing the semId which is a foreign key in the COurse model

See Lookups that span relationships.

reveal how you are trying things right now to getthe error, you should show what you’re doing even if it isn’t working