You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And if you remove the filter, I get all users in a room, but I need to get only rooms where there is a user with a specific id and to show all users in that room, not just the one whose id I entered in the filter.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
How to get a room by user who is in it and together with the room get all users who are in the room?
I make this request, but I get only one user and the one whose id I entered, but I want to get a room with all users who are in it
And this is what I get
[Room({'id': 1, 'messages': [], 'users': [User({'id': 1, 'username': 'alex', 'avatar': 'media/default/avatar', 'bio': None, 'password': '$2b$12$RR9X/eR2YJ2kPCVJjFi89uYxxkskj5IUBXR4iRKNSyEe3AYt1soX.', 'messages': [], 'rooms': [<weakproxy at 0x000001A1CB759440 to Room at 0x000001A1CB7265F0>], 'roomuser': RoomUser({'id': 2, 'user': None, 'room': None})})], 'roommessage': None, 'roomuser': None})]
But with this query I get
[Room({'id': 1, 'messages': [], 'users': [User({'id': 2, 'username': 'john', 'avatar': 'media/default/avatar', 'bio': None, 'password': '$2b$12$RR9X/eR2YJ2kPCVJjFi89uYxxkskj5IUBXR4iRKNSyEe3AYt1soX.', 'messages': [], 'rooms': [<weakproxy at 0x000001A1CB759440 to Room at 0x000001A1CB7265F0>], 'roomuser': RoomUser({'id': 1, 'user': None, 'room': None})})], 'roommessage': None, 'roomuser': None})]
And if you remove the filter, I get all users in a room, but I need to get only rooms where there is a user with a specific id and to show all users in that room, not just the one whose id I entered in the filter.
[Room({'id': 1, 'messages': [], 'users': [User({'id': 1, 'username': 'alex', 'avatar': 'media/default/avatar', 'bio': None, 'password': '$2b$12$RR9X/eR2YJ2kPCVJjFi89uYxxkskj5IUBXR4iRKNSyEe3AYt1soX.', 'messages': [], 'rooms': [<weakproxy at 0x0000029972E89580 to Room at 0x0000029972E84C20>], 'roomuser': RoomUser({'id': 2, 'user': None, 'room': None})}), User({'id': 2, 'username': 'john', 'avatar': 'media/default/avatar', 'bio': None, 'password': '$2b$12$6n7aEXIYlkU2KGUvOeTCQeOfLMyL.PYUemS.DX8mqBnr0erZEblJC', 'messages': [], 'rooms': [<weakproxy at 0x0000029972E89A80 to NoneType at 0x00007FFEA36B7CC8>], 'roomuser': RoomUser({'id': 1, 'user': None, 'room': None})})], 'roommessage': None, 'roomuser': None})]
As you can see I only get one user whose id I entered but why? How can I get all users in the room?
My models:
Beta Was this translation helpful? Give feedback.
All reactions