Roberto Fernandez Diaz
Roberto Fernandez Diaz

Reputation: 804

unresolved reference pycharm doesn't recognize class under it

I have the following problem.

I have something like this

class X(models.Model):
    def add_meber(self, user : User <-Error here):
        # code

class User(AbstractUser):
    # Code

Pycharm is no the class User when I use the type hint in the class X, there is a way to make this work ?

Upvotes: 1

Views: 886

Answers (1)

user2235698
user2235698

Reputation: 7639

Wrap User with quotes in annotation or use postponed evaluation of annotations in case of Python 3.7.

Upvotes: 2

Related Questions