title: Flask error TypeError: Incompatible collection type: str is not list-like
body: <p>I am getting error when adding data to the table from a view in Flask. The table I am trying to update has ForeignKey relation to another model. However I am trying to update child model. Following is a simple case:</p>
  
  <p>Models:</p>
  
  <h1>Parent Model</h1>
  
  <pre><code>class Student(db.Model):
     __tablename__='student'
     ....
     package = package = relationship('Package', backref=backref('student'))
     ....
     def __init__(self, **kwargs):
          for key, value in kwargs.items():
              setattr(self, key, value)
  </code></pre>
  
  <h1>Child Model</h1>
  
  <pre><code>class Package(db.Model):
      __tablename__ = 'package'
  
      id = db.Column(db.Integer, primary_key=True, autoincrement=True)
      student_id = db.Column(db.Integer, ForeignKey('student.id'))
      stripe_id = db.Column(db.String(45))
      student_email = db.Column(db.String(20))
      subscription_date = db.Column(db.DateTime, default=today)
      expiry_date = db.Column(db.DateTime, default=deadline)
      is_active = db.Column(db.Boolean, default=True)
      planname = relationship('Plan', backref=backref('package'))
      package_price = db.Column(db.Integer)
      coupon = db.Column(db.String(12))
  
      def __init__(self, **kwargs):
          for key, value in kwargs.items():
              setattr(self, key, value)
  </code></pre>
  
  <p>My View:</p>
  
  <pre><code>@app.route('/yearlychargedrec', methods=['GET', 'POST'])
  def yearly_charged_rec():
  
      if not user_authorized():
          return redirect('/')
      # customer
      stripe_token = request.form['stripeToken']
      email = request.form['stripeEmail']
  
      customer = stripe.Customer.create(
          email=email,
          source=request.form['stripeToken']
      )
      try:
          subscription = stripe.Subscription.create(
              customer=customer.id,
              plan="yearlyrec",
          )
  
      except stripe.error.CardError as e:
          # The card has been declined
          body = e.json_body
          err = body['error']
      if request.method == 'POST':
          # email = email 
  
          package = Package(
  
              is_active=True,
              planname = 'yearlyrec',
  
          )
          db.session.add(package)
          db.session.commit()
  
      return render_template('/profile/charge/monthlycharge.html')
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>TypeError: Incompatible collection type: str is not list-like
  </code></pre>