diff --git a/app.py b/app.py index 78d263c..584e58b 100755 --- a/app.py +++ b/app.py @@ -327,7 +327,8 @@ def edit_player(player_id): hostname = request.form['hostname'] password = request.form['password'] if request.form['password'] else None quickconnect_password = request.form['quickconnect_password'] if request.form['quickconnect_password'] else None - edit_player_util(player_id, username, hostname, password, quickconnect_password) + orientation = request.form.get('orientation', player.orientation) # <-- Get orientation + edit_player_util(player_id, username, hostname, password, quickconnect_password, orientation) # <-- Pass orientation flash(f'Player "{username}" updated successfully.', 'success') return redirect(url_for('player_page', player_id=player.id)) @@ -648,14 +649,14 @@ def create_admin(username, password): from models.create_default_user import create_default_user -with app.app_context(): - try: - db.session.execute(db.select(User).limit(1)) - except Exception as e: - print("Database not initialized or missing tables. Re-initializing...") - db.create_all() - # Always ensure default user exists - create_default_user(db, User, bcrypt) +if not app.debug or os.environ.get('WERKZEUG_RUN_MAIN') == 'true': + with app.app_context(): + try: + db.session.execute(db.select(User).limit(1)) + except Exception as e: + print("Database not initialized or missing tables. Re-initializing...") + db.create_all() + create_default_user(db, User, bcrypt) # Add this at the end of app.py if __name__ == '__main__': diff --git a/instance/dashboard.db b/instance/dashboard.db index 9fbfd2a..67f6fdd 100644 Binary files a/instance/dashboard.db and b/instance/dashboard.db differ diff --git a/templates/create_group.html b/templates/create_group.html index 748ee56..8545775 100644 --- a/templates/create_group.html +++ b/templates/create_group.html @@ -49,11 +49,23 @@ +