title: Why can't I import User model in django?
body: <p>I am building a django web app with a custom user model which extends the AbstractBaseUser. In one of my models I need to use this custom user model:</p>
  
  <pre><code>from accounts.models import User
  
  class History(models.Model):
      user = models.ForeignKey(User)
      job = models.ForeignKey(Job)
  </code></pre>
  
  <p>When I try to run the <code>python manage.py makemigrations</code> command this error message is outputted:</p>
  
  <pre><code>ImportError: cannot import name User
  </code></pre>
  
  <p>In my settings.py I do the following to let django know that there is a custom user model:</p>
  
  <pre><code>AUTH_USER_MODEL = "accounts.User"
  </code></pre>
  
  <p>I am puzzled as to what I am doing wrong. Surely there must be a way to import this model that I do not know of. How do I fix this?</p>
  
  <p>I have tried to use the get_user_model() method, however it doesn't work in the model as the models haven't loaded yet. This is therefore not a solution. Any other ideas?</p>
  
  <p>Thank you in advance.</p>