I don't see any conflicts with the following. What am I doing wrong? I get the following error ImportError: cannot import name 'Business' from 'business.models'
I assume maybe I am doing some type of circular loop, but I do not see it.:
#links/models.py
from django.db import models
class LinkType(models.Model):
link_type = models.CharField(max_length=30)
def __str__(self):
return self.link_type
from business.models import Business
class Link(models.Model):
name = models.CharField(max_length=60)
business = models.ForeignKey(Business, on_delete=models.CASCADE)
link_type = models.ForeignKey(LinkType, on_delete=models.CASCADE)
class Meta:
unique_together = ['business', 'link_type']
def __str__(self):
return self.name
#business/models.py
from django.db import models
from links.models import LinkType
class Business(models.Model):
name = models.CharField(max_length=255)
main_link_type = models.ForeignKey(LinkType, on_delete=models.CASCADE)
def __str__(self):
return self.name