[Answered ]-Using OneToOneField in Django

2πŸ‘

βœ…

If I understand your code organization correctly, the problem is in your imports. When you say

from . import Role

you’re importing Role.py into a module object named Role. Inside that module (I assume) is your Role model class. So what you really want is:

from .Role import Role

Or:

from . import Role

...
role_id = models.OneToOneField(Role.Role)

0πŸ‘

You should define an app_label in your meta class

class Foo(models.Model):
    class Meta:
        app_label = 'mainws'
πŸ‘€DRC

Leave a comment