When reading the topics related to Django's select_related() and prefetch_related() on some websites including Stack Overflow, I frequently see the words Forward Foreign Key and Reverse Foreign Key but I couldn't find the definitions on Django Documentation:
# "models.py"
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=20)
class Product(models.Model):
category = models.ForeignKey(Category, on_delete=models.CASCADE)
name = models.CharField(max_length=50)
price = models.DecimalField(decimal_places=2, max_digits=5)
So, what are Forward Foreign Key and Reverse Foreign Key in Django?