title: Flask admin remember form value
body: <p>In my application, I have Users and Posts as models. Each post has a foreign key to a username. When I create a ModelView on top of my Posts model I can create posts as specific users in the admin interface 
  as seen in the screenshot below</p>
  
  <p><a href="https://i.stack.imgur.com/DdBkJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DdBkJ.png" alt="enter image description here"></a></p>
  
  <p>After I have added a post and click "Save and Add Another", the "User" reverts back to "user1". How can I make the form remember the previous value "user2"? </p>
  
  <p>My reserach has led me to believe it can be done by modifying on_model_change and on_form_prefill, and saving the previous value in the flask session, but it seems to be overengineering such a simple task. There must be a simpler way.</p>
  
  <p>My code can be seen below</p>
  
  <pre class="lang-py prettyprint-override"><code>from flask import Flask
  from flask_sqlalchemy import SQLAlchemy
  import flask_admin
  from flask_admin.contrib import sqla
  
  app = Flask(__name__)
  
  db = SQLAlchemy()
  
  admin = flask_admin.Admin(name='Test')
  
  
  class Users(db.Model):
      """
      Contains users of the database
      """
      user_id = db.Column(db.Integer, primary_key=True)
      username = db.Column(db.String(64), index=True, unique=True, nullable=False)
  
      def __str__(self):
          return self.username
  
  
  class Posts(db.Model):
      """
      Contains users of the database
      """
      post_id = db.Column(db.Integer, primary_key=True)
      username = db.Column(db.String(11), db.ForeignKey(Users.username), nullable=False)
      post = db.Column(db.String(256))
      user = db.relation(Users, backref='user')
  
  
  def build_sample_db():
      db.drop_all()
      db.create_all()
      data = {'user1': 'post1', 'user1': 'post2', 'user2': 'post1'}
      for user, post in data.items():
  
          u = Users(username=user)
          p = Posts(username=user, post=post)
  
          db.session.add(u)
          db.session.add(p)
      db.session.commit()
  
  class MyModelView(sqla.ModelView):
  
      pass
  
  
  if __name__ == '__main__':
  
      app.config['SECRET_KEY'] = '123456790'
      app.config['DATABASE_FILE'] = 'sample_db.sqlite'
      app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database'
      app.config['SQLALCHEMY_ECHO'] = True
      db.init_app(app)
  
      admin.init_app(app)
      admin.add_view(MyModelView(Posts, db.session))
  
      with app.app_context():
          build_sample_db()
  
      # Start app
      app.run(debug=True)
  
  </code></pre>