Reputation: 779
This is my SQL:
"SELECT DISTINCT generate_series(start_date::date, end_date::date, '1 day'::interval) AS dates, * FROM api_event ORDER BY dates")
How can i do this using Django ORM?
Upvotes: 0
Views: 266
Reputation: 779
Ok. I find decision. Maybe someone need this to:
On Django ORM this will be like that:
Event.objects.annotate(dates=Func(F('start_date'), F('end_date'), Value('1 day'), function='generate_series')).all()
Upvotes: 4