I have a datatable which filters data by user id. This is my login function.
LoginScreen.py
def login(self):
username = self.ids.username.text
password = self.ids.password.text
login_check = database_handler.check_username(username, password)
if login_check:
Snackbar(text="Login successful").open()
else:
Snackbar(text="invalid username/password").open()
database_handler.py
def get_entries():
parent = // current logged in user id
sql = "SELECT * FROM entrymonitoring WHERE parent_id = (SELECT parent FROM parent_mystudent WHERE parent = parent) ORDER BY `date` DESC LIMIT 6"
cursor.execute(sql)
results = cursor.fetchall()
return results
My log in works and the get_entries works too if I write specific value to filter the rows I wanted to display. I’m totally noob, I don’t know how to get the current logged in user id. Do I need to store it like in django, we used session. But kivy is totally new to me, can someone help me how to get the it? Thank you in advance!
New contributor
zheni is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.