title: AttributeError: 'int' object has no attribute 'name' when trying to retrieve relationship data
body: <p>I created these tables using SQLAlchemy:</p>
  
  <pre><code>class User(db.Model):
      __tablename__ = 'users'
      id = db.Column(db.Integer, primary_key=True)
      ## user info
      name = db.Column(db.String)
      email = db.Column(db.String)
      password = db.Column(db.String)
      category = db.Column(db.Enum('admin', 'employee', 'client', name='user_category'),\
          default='client')
      role = db.Column(db.String)
  
      def check_password(self, password):
          return check_password_hash(self.password, password)
  
      def set_password(self, password):
          self.password = generate_password_hash(password)
  
      def is_authenticated(self):
          return True
  
      def is_active(self):
          return True
  
      def is_anonymous(self):
          return False
  
      def get_id(self):
          try:
              return unicode(self.id)  # python 2
          except NameError:
              return str(self.id)  # python 3
  
      def get_category(self):
          return self.category
  
      def __repr__(self):
          return '&lt;User %r&gt;' % self.name
  
  class Ticket(db.Model):
      __tablename__ = 'tickets'
      id = db.Column(db.Integer, primary_key=True)
      title = db.Column(db.String)
      description = db.Column(db.Text)
      priority = db.Column(db.Enum('high', 'normal', \
          'low', name='ticket_priority'), default='normal')
      status = db.Column(db.Enum('open', 'closed', \
          'on hold', name='ticket_status'), default='open')
      start_time = db.Column(db.DateTime)
      end_time = db.Column(db.DateTime)
      worked_hours = db.Column(db.Interval,
          default=datetime.timedelta(days=0, hours=0, minutes=0, seconds=0))
      play_time = db.Column(db.DateTime)
      pause_time = db.Column(db.DateTime)
      client = db.Column(db.Integer, db.ForeignKey('users.id'))
      employee = db.Column(db.Integer, db.ForeignKey('users.id'))
  
      def __repr__(self):
          return '&lt;Ticket %r&gt;' % self.title
  </code></pre>
  
  <p>In my template, I have this html:</p>
  
  <pre><code>        &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;{{ _('Client') }}&lt;/th&gt;
              &lt;th&gt;{{ _('Employee') }}&lt;/th&gt;
              &lt;th&gt;{{ _('Start Time') }}&lt;/th&gt;
              &lt;th&gt;{{ _('End Time') }}&lt;/th&gt;
          &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;{{ ticket.client.name }}&lt;/td&gt;
              &lt;td&gt;{{ ticket.employee.name }}&lt;/td&gt;
              &lt;td&gt;{{ ticket.start_time }}&lt;/td&gt;
              &lt;td&gt;{{ ticket.end_time }}&lt;/td&gt;
          &lt;/tr&gt;
          &lt;/tbody&gt;
  </code></pre>
  
  <p>But when I open this page, neither client or employee names are displayed. When trying to print the <strong>ticket.client.name</strong>, it return this error:</p>
  
  <pre><code>AttributeError: 'int' object has no attribute 'name'
  </code></pre>
  
  <p>Why is it happening and how can I access the client information in the correct way?</p>