Support for before_models_flushed and models_flushed signals

The first commit includes a fix for breakage of sqlalchemy hooks done by mistake in mitsuhiko/flask-sqlalchemy@cf40caec1c48fc2188597ca4e6ddfb21b770d9d7

The second commit introduces support for before_models_flushed and models_flushed signals, closing mitsuhiko/flask-sqlalchemy#9