Issue
I'm trying to obtain data using django filter and connected to postgres database. The filter statement leads to error- 'ValueError: too many values to unpack (expected 2)'
Here is the sql equivalent and my attempt at creating a django filter query You would notice that I have used two columns for storing datetime, review_time_datetime and match_time_datetime
SQL Equivalent QUERY
SELECT *
FROM "table1" where review_time_datetime >'2021-06-14 00:00'
and match_time_datetime < '2021-06-14 24:00'
Django Filter QUERY
filter_query = table1.objects.filter(review_time_datetime, match_time_datetime)
Solution
Try using:
filter_query = table1.objects.filter(review_time_datetime__gt=from_date, match_time_datetime__lt=to_date)
Answered By - Prakash S
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.