>
> Assuming (start1, end1) is the range you want to validate against
> SomeModel's time.end and time.start fields:
>
> SomeModel.objects.filter(time__end__gte=start1,
> time__start__lte=end1).count()
>
> Basically, this is an implemenation of your above math rewritten this
> way:
>
> ( end2 >= st
On Mar 9, 11:28 am, gnijholt wrote:
> Hello django-users,
>
> I'm having some trouble with a date-range filter.
> My goal is to prevent a model from being saved when it's date-range
> overlaps with existing records.
>
> Apparently, the math is quite straightforward:
>
> ( start1 <= end2 and sta
On Mar 9, 11:28 am, gnijholt wrote:
> Hello django-users,
>
> I'm having some trouble with a date-range filter.
> My goal is to prevent a model from being saved when it's date-range
> overlaps with existing records.
>
> Apparently, the math is quite straightforward:
>
> ( start1 <= end2 and sta
You have a problem with your calculation, if you dont want any overlap
at all.
The above code will only be true when the intire range of start/end 2
is within start/end 1.
what you need to check if you dont want any overlap is these two
statements:
(start1 <= start2 and end1 >= start2)
(start1 <=
Hello django-users,
I'm having some trouble with a date-range filter.
My goal is to prevent a model from being saved when it's date-range
overlaps with existing records.
Apparently, the math is quite straightforward:
( start1 <= end2 and start2 <= end1 )
if TRUE, the ranges overlap (*)
Still
5 matches
Mail list logo