I have an app customer inside company/sales/ with app_label as 'company.sales.customer'. This app contains a model Customer in models.py.
I want this model to be linked as a foreign key in another app 'orders'.
models.py of 'orders':
from django.db import models
class Order(models.Model):
party = models.ForeignKey('company.sales.customer.Customer', on_delete=models.CASCADE)
--other fields--
apps.py of 'customer':
from django.apps import AppConfig
class CustomerConfig(AppConfig):
name = 'company.sales.customer'
label = 'company.sales.customer'
settings.py :
INSTALLED_APPS = [
----,
'company.sales.customer'
]
On running python manage.py makemigrations, I get this error :
ValueError: Invalid model reference 'company.sales.customer.Customer'. String model references must be of the form 'app_label.ModelName'.