Bump Django to 4.1.* (#2989)

This commit is contained in:
Raphael Michel
2023-06-05 09:56:31 +02:00
committed by GitHub
parent 3a8556bb78
commit bd32b33ba9
119 changed files with 742 additions and 613 deletions

View File

@@ -21,6 +21,7 @@
#
from datetime import datetime, time, timedelta
from dateutil.tz import datetime_exists
from django.db import models
from django.db.models import Exists, OuterRef, Q
from django.utils import timezone
@@ -69,6 +70,9 @@ class ScheduledMail(models.Model):
def save(self, **kwargs):
if not self.computed_datetime:
self.recompute()
if 'update_fields' in kwargs:
kwargs['update_fields'] = {'computed_datetime', 'last_computed', 'state'}.union(kwargs['update_fields'])
super().save(**kwargs)
def recompute(self):
@@ -88,10 +92,14 @@ class ScheduledMail(models.Model):
base_time = (e.date_to or e.date_from) if self.rule.offset_to_event_end else e.date_from
d = base_time.astimezone(self.event.timezone).date() + offset
self.computed_datetime = make_aware(
datetime.combine(d, time(hour=st.hour, minute=st.minute, second=st.second, microsecond=0)),
datetime.combine(d, time(hour=st.hour, minute=st.minute, second=st.second, microsecond=0, fold=1)),
self.event.timezone,
is_dst=False, # prevent AmbiguousTimeError
)
if not datetime_exists(self.computed_datetime):
self.computed_datetime = make_aware(
datetime.combine(d, time(hour=st.hour, minute=st.minute, second=st.second, microsecond=0)) + timedelta(hours=1),
self.event.timezone,
)
if self.computed_datetime > timezone.now() and self.state == self.STATE_MISSED:
self.state = self.STATE_SCHEDULED

View File

@@ -32,7 +32,7 @@
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under the License.
from django.conf.urls import re_path
from django.urls import re_path
from pretix.api.urls import event_router