i thinks it will be helpful if you place screenshots of you project file structure as you mentioned along with models, so that people can easily trace out the issue.....
On Thu, Sep 24, 2020 at 2:30 PM Pradyum Gupta <pradyum.gup...@gmail.com> wrote: > In My Django Project, there are two apps: Login and Company > > > > The **error that am receiving** in this is > > ```python > > AttributeError: module 'login.models' has no attribute 'Country' > > ``` > > > > *Company App* > models.py > > ```python > > from django.db import models > > from login import models as LM > > > > class CompanyProfile(models.Model): > > full_name = models.CharField(max_length=255, > > unique = True) > > > > country = models.ForeignKey(LM.Country, > > on_delete=models.SET_NULL, > > null=True, > > blank=False) > > > > state = models.ForeignKey(LM.State, > > on_delete=models.SET_NULL, > > null=True, > > blank=False) > > def __str__(self): > > return self.full_name > > ``` > > > > *Login App* > models.py > > ````python > > > > class Country(models.Model): > > """List of Country""" > > name = models.CharField(max_length=50, unique= True, default='None') > > code = models.CharField(max_length=2, unique= True, primary_key=True, > default ='NA') > > > > def __str__(self): > > return str(self.code) > > > > class State(models.Model): > > """List fo State""" > > region = models.CharField(max_length = 255, unique = True, > primary_key=True, default='None') > > country = models.ForeignKey(Country, on_delete=models.SET_NULL, > null=True, blank=False, default ='NA') > > > > def __str__(self): > > return self.region > > > > ```` > > > > Here is test to check that weather is login is getting imported or not > > ```python > > def test_import(): > > try: > > # import pdb; pdb.set_trace() > > importlib.find_loader('LM.Country') > > found = True > > except ImportError: > > found = False > > print(found) > > ``` > > > > Answer is received stands to be True > > ``` > > python3 manage.py shell > > >>> test_import() > > True > > ``` > > > > Now on other stackoverflow blogs i checked i thought it could be of > ```Circlular Import``` > > But i have already fixed that still am getting this error? > > > > Thanks in Advance > > Regards > > > > PS: I have also asked the same question here > https://stackoverflow.com/q/64042995/7999665 > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Django REST framework" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-rest-framework+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-rest-framework/SG2PR04MB27612A4B2E7020F7576BF114A7390%40SG2PR04MB2761.apcprd04.prod.outlook.com > <https://groups.google.com/d/msgid/django-rest-framework/SG2PR04MB27612A4B2E7020F7576BF114A7390%40SG2PR04MB2761.apcprd04.prod.outlook.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/CAN9FMSwvU7dNB%2BDcZkDyVjxbwAFs-bRYdPJFvX9dRgM1fkD5Gg%40mail.gmail.com.