Skip to content
Snippets Groups Projects
Verified Commit 1ca144ad authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Fix constraints

parent 356ffbc2
No related branches found
No related tags found
1 merge request!1711Fix constraints
Pipeline #195831 failed
......@@ -1707,10 +1707,16 @@ class CalendarEvent(CalendarEventMixin, ExtensiblePolymorphicModel, RecurrenceMo
name="datetime_end_or_date_end",
),
models.CheckConstraint(
check=Q(datetime_end__gte=F("datetime_start")), name="datetime_start_before_end"
check=Q(datetime_end__gte=F("datetime_start"))
| Q(datetime_start__isnull=True)
| Q(datetime_end__isnull=True),
name="datetime_start_before_end",
),
models.CheckConstraint(
check=Q(date_end__gte=F("date_start")), name="date_start_before_end"
check=Q(date_end__gte=F("date_start"))
| Q(date_start__isnull=True)
| Q(date_end__isnull=True),
name="date_start_before_end",
),
models.CheckConstraint(
check=~(Q(datetime_start__isnull=False, timezone="") & ~Q(recurrences="")),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment