Re: Django model object filter with empty values

2018-10-09 Thread Moreplavec
Thank you, i will solve it with Q, it makes sense and will make it clear in future edits. On Tuesday, 9 October 2018 21:50:50 UTC+2, Mateusz wrote: > > There are many ways to resolve your problem. According to > https://stackoverflow.com/questions/769843/how-do-i-use-and-in-a-django-filter > th

Re: Django model object filter with empty values

2018-10-09 Thread Mateusz
There are many ways to resolve your problem. According to https://stackoverflow.com/questions/769843/how-do-i-use-and-in-a-django-filter this should work: from django.db.models import Q date_range = Q(date_stop__range=[today, today_plus_ten]) date_none = Q(date_start=today, date_stop=None) cours

Re: Django model object filter with empty values

2018-10-09 Thread Mateusz
There are many ways to resolve your problem. According to https://stackoverflow.com/questions/769843/how-do-i-use-and-in-a-django-filter one (or both) of these should work: #1 coursedates_ending = CourseDate.objects.filter(date_stop__range=[today, today_plus_ten], date_stop=None).order_by('dat

Django model object filter with empty values

2018-10-09 Thread Moreplavec
Hello, I have DB with courses and each course has many dates (with starting and ending date). I'm trying to make report with starting and ending course dates in 10 days. The problem is, that one day courses usually don't have ending date (date_stop) filled. Right now i'm using query: coursedat