Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Role.insert_roles()
admin_role = Role.query.filter_by(name=Administrator’).first()
default_role = Role.query.filter_by(default=True).first()
for u in User.query.all():
if u.role is None:
if u.email == app.config[‘OFFBRAND_ADMIN’]:
u.role = admin_role
else:
u.role = default_role
db.session.commit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.