Issue with ForeignKey relationship in Django model

I’m encountering an issue with defining a ForeignKey relationship in my Django model and would appreciate some guidance.

Here’s a simplified version of my models:

from django.db import models

class Author(models.Model):
    name = models.CharField(max_length=100)
    # Other fields...

class Book(models.Model):
    title = models.CharField(max_length=100)
    author = models.ForeignKey(Author, on_delete=models.CASCADE)
    # Other fields...

When I try to migrate these models using python manage.py makemigrations and python manage.py migrate, I encounter an error related to the ForeignKey relationship. The error message I’m receiving is:

ERRORS:
forum_book.author: (fields.E300) Field defines a relation with model 'Author', which is either not installed, or is abstract.

I’ve double-checked that the Author model is defined in the same file and that it’s not marked as abstract. I’m not sure why Django is throwing this error. If you want to download capcut pro apk then visit the given link. Can someone please help me understand what might be causing this issue and how I can resolve it? Any insights or suggestions would be greatly appreciated. Thank you!

Welcome @jaindeen4 !

Unfortunately, this may be one of those situations where we need to see the complete models.py file. You might not have it defined as abstract, but there is likely a different issue with one of your model definitions that is causing this error.