[Answered ]-Check Overlapping intervals integerfield validation django python

1👍

I think to check for overlapping you need to make sure that neither the start nor the end of your new object is within an existing interval.

So I would suggest something like this:

conflicts = Check.objects.filter(
    start_bbch__gte=start, end_end__lte=start
) | Check.objects.filter(
    start_bbch__gte=end, end_end__lte=end
)

Leave a comment