1👍
✅
Meeting.objects.filter
is not returning a Meeting
– it is returning a QuerySet
of meetings. You can iterate through the QuerySet
to get the meeting time of each meeting:
for user_id in get_all_user_of_org:
mee_data = {}
get_meetings = Meeting.objects.filter(created_by = user_id.id)
print dir(get_meetings)
for meeting in get_meetings:
do_something_with(meeting.start_time)
You have to realize you’re dealing with more than one meeting here, and they might have different start times. You’ll know best what you want to do in that case. Probably something like this?
for user_id in get_all_user_of_org:
get_meetings = Meeting.objects.filter(created_by = user_id.id)
for meeting in get_meetings:
mee_data = {}
mee_data['start_time'] = meeting.start_time
getall.append(mee_data)
0👍
Well you are using
get_meetings = Meeting.objects.filter(created_by = user_id.id)
This return type of filter
is a queryset object which can have one or multiple objects.
To get the start_time
of all the meetings
of a user
, you should use something like
get_meeting_start_times = Meeting.objects.filter(created_by = user_id.id).values_list('start_time', flat=True)
Source:stackexchange.com