From fbe1c78399516617263987edf666caf90fc8ed7d Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 21 Mar 2018 21:17:34 +0100 Subject: [PATCH] tiny fix on newuser.py --- newuser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/newuser.py b/newuser.py index 072ec291..7e1945a8 100644 --- a/newuser.py +++ b/newuser.py @@ -1,7 +1,10 @@ import db session = db.Session() -user = db.Royal.create(session, input("Nome account: ")) +username = input("Nome account: ") +user = session.query(db.Royal).filter_by(username=username).one_or_none() +if user is None: + user = db.Royal.create(session, username) session.add(user) session.commit() try: