title: How do I create a foreign key to the User table in Django?
body: <p>I'm creating a new model called Tickets which I want to ensure always has a valid userID assigned to it.</p>
  
  <p>I'm using <code>AUTH_PROFILE_MODULE</code> to setup the profile which also gives the error <strong>NameError: name 'User' is not defined</strong> when I try to run syndb.</p>
  
  <p>How do I setup a foreign key to make sure this always is the case?</p>
  
  <pre><code>## tickets/models.py
  
  class Ticket(models.Model):
      user = models.ForeignKey(User,)
      # More model stuff.
  
  
  
  # accounts/models.py   
  
  class UserProfile(models.Model):
       user = models.ForeignKey(User, unique=True)
  </code></pre>