|
|
|
@ -25,7 +25,6 @@ import sys
|
|
|
|
|
import uuid
|
|
|
|
|
from contextlib import contextmanager
|
|
|
|
|
|
|
|
|
|
import django
|
|
|
|
|
import requests
|
|
|
|
|
import vobject
|
|
|
|
|
from dateutil.relativedelta import SU, relativedelta
|
|
|
|
@ -51,7 +50,7 @@ from django.db.models import (
|
|
|
|
|
Subquery,
|
|
|
|
|
Value,
|
|
|
|
|
)
|
|
|
|
|
from django.db.models.functions import Cast, Coalesce, Concat, ExtractWeek, ExtractWeekDay
|
|
|
|
|
from django.db.models.functions import Cast, Coalesce, Concat, ExtractWeek, ExtractWeekDay, JSONObject
|
|
|
|
|
from django.template import Context, Template, TemplateSyntaxError, VariableDoesNotExist, engines
|
|
|
|
|
from django.urls import reverse
|
|
|
|
|
from django.utils import functional
|
|
|
|
@ -1697,22 +1696,10 @@ class Event(models.Model):
|
|
|
|
|
if agendas:
|
|
|
|
|
overlapping_events = overlapping_events.filter(agenda__in=agendas)
|
|
|
|
|
|
|
|
|
|
if django.VERSION >= (3, 2):
|
|
|
|
|
from django.db.models.functions import JSONObject
|
|
|
|
|
|
|
|
|
|
json_object = JSONObject(
|
|
|
|
|
slug=F('computed_slug'),
|
|
|
|
|
days=F('recurrence_days'),
|
|
|
|
|
)
|
|
|
|
|
else:
|
|
|
|
|
json_object = Func(
|
|
|
|
|
Value('slug'),
|
|
|
|
|
'computed_slug',
|
|
|
|
|
Value('days'),
|
|
|
|
|
'recurrence_days',
|
|
|
|
|
function='jsonb_build_object',
|
|
|
|
|
output_field=models.JSONField(),
|
|
|
|
|
)
|
|
|
|
|
json_object = JSONObject(
|
|
|
|
|
slug=F('computed_slug'),
|
|
|
|
|
days=F('recurrence_days'),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return qs.annotate(
|
|
|
|
|
overlaps=ArraySubquery(
|
|
|
|
|