Ok so, I have created 2 model classes for my Django Rest application and am trying to use foreign key to join both models.
Here's my code:
from django.db import models
from . import Author
title = models.CharField(max_length=100)
author = models.ForeignKey(Author, on_delete=models.CASCADE)
date = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=100)
email = models.EmailField(max_length=100)
The thing is, this line from . import Author is kind of annoying, and when I remove it Pylance puts a warning message in the Author parameter at the Article class ("Author" is not defined).
My question is, do I really need to import the class in the same file it is being used?