Fix query
This commit is contained in:
@@ -383,11 +383,10 @@ def recent_actions(current_user):
|
|||||||
# RECENT_ACTIONS = "SELECT * FROM members_actions WHERE member_id = " + user_id + " ORDER by id DESC LIMIT 4"
|
# RECENT_ACTIONS = "SELECT * FROM members_actions WHERE member_id = " + user_id + " ORDER by id DESC LIMIT 4"
|
||||||
RECENT_ACTIONS = "SELECT * FROM members_actions WHERE member_id = $1 ORDER by id DESC LIMIT 4"
|
RECENT_ACTIONS = "SELECT * FROM members_actions WHERE member_id = $1 ORDER by id DESC LIMIT 4"
|
||||||
actionVal = (user_id)
|
actionVal = (user_id)
|
||||||
|
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||||
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
cursor.execute(RECENT_ACTIONS,actionVal)
|
||||||
cursor.execute(RECENT_ACTIONS,actionVal)
|
recent_actions = cursor.fetchall()
|
||||||
recent_actions = cursor.fetchall()
|
print(recent_actions)
|
||||||
print(recent_actions)
|
|
||||||
|
|
||||||
action_data = {
|
action_data = {
|
||||||
"recent_actions" : recent_actions,
|
"recent_actions" : recent_actions,
|
||||||
|
|||||||
Reference in New Issue
Block a user