getting the id
This commit is contained in:
@@ -383,14 +383,14 @@ def complete_register():
|
|||||||
password= data['password']
|
password= data['password']
|
||||||
country= data['country']
|
country= data['country']
|
||||||
|
|
||||||
FIND_USERNAME= f"SELECT * FROM members WHERE username::text = '{username}' "
|
FIND_USERNAME= f"SELECT id FROM members WHERE username::text = '{username}' "
|
||||||
print(FIND_USERNAME)
|
print(FIND_USERNAME)
|
||||||
with connection:
|
with connection:
|
||||||
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||||
cursor.execute(FIND_USERNAME)
|
cursor.execute(FIND_USERNAME)
|
||||||
user_search = cursor.fetchall()
|
user_search = cursor.fetchall()
|
||||||
print(user_search)
|
print(user_search)
|
||||||
print(user_search[0])
|
print(user_search[0][0])
|
||||||
if user_search[0]:
|
if user_search[0]:
|
||||||
return jsonify({'status': "DUPLICATE",'message': 'Error - use another username'}), 200
|
return jsonify({'status': "DUPLICATE",'message': 'Error - use another username'}), 200
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user