-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusers.py
31 lines (18 loc) · 830 Bytes
/
users.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from db import connection, sql
#CREATE user
def add_user(name, username, password, email, role, avatar):
if not name: return "No data received in add_user()"
query = '''
insert into users (name, username, password, email, role, avatar) values (?,?,?,?,?,?);
'''
sql.execute(query, [name, username, password, email, role, avatar])
connection.commit()
return "User has been added"
#RETRIEVE user
#UPDATE user
#DELETE user
#CREATE TEST DATA
def create_test_data():
add_user("Wilhelm Singh","wsing1","12345678","[email protected]","guest","https://cdn.pixabay.com/photo/2015/03/04/22/35/head-659652_1280.png")
add_user("Nicole Singh","nsing1","12345678","[email protected]","guest","https://cdn4.iconfinder.com/data/icons/ibrandify-female-user-action-icon/512/19-512.png")
return