mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 12:30:15 +02:00
django.utils.timezone.utc alias is removed
This commit is contained in:
parent
cc8f53af12
commit
826198e5a7
@ -2,6 +2,7 @@
|
|||||||
Django system checks for Alliance Auth
|
Django system checks for Alliance Auth
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from datetime import datetime, timezone
|
||||||
from sqlite3.dbapi2 import sqlite_version_info
|
from sqlite3.dbapi2 import sqlite_version_info
|
||||||
|
|
||||||
from celery import current_app
|
from celery import current_app
|
||||||
@ -10,7 +11,6 @@ from packaging.version import InvalidVersion, Version as Pep440Version
|
|||||||
from django import db
|
from django import db
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.checks import CheckMessage, Error, Warning, register
|
from django.core.checks import CheckMessage, Error, Warning, register
|
||||||
from django.utils import timezone
|
|
||||||
|
|
||||||
from allianceauth.utils.cache import get_redis_client
|
from allianceauth.utils.cache import get_redis_client
|
||||||
|
|
||||||
@ -137,8 +137,8 @@ def system_package_redis(app_configs, **kwargs) -> list[CheckMessage]:
|
|||||||
if (
|
if (
|
||||||
redis_version.major == 7
|
redis_version.major == 7
|
||||||
and redis_version.minor == 2
|
and redis_version.minor == 2
|
||||||
and timezone.now()
|
and datetime.now(timezone.utc)
|
||||||
> timezone.datetime(year=2025, month=8, day=31, tzinfo=timezone.utc)
|
> datetime(year=2025, month=8, day=31, tzinfo=timezone.utc)
|
||||||
):
|
):
|
||||||
errors.append(
|
errors.append(
|
||||||
Error(
|
Error(
|
||||||
@ -205,7 +205,7 @@ def system_package_mysql(app_configs, **kwargs) -> list[CheckMessage]:
|
|||||||
|
|
||||||
# MySQL 8
|
# MySQL 8
|
||||||
if mysql_version.major == 8:
|
if mysql_version.major == 8:
|
||||||
if mysql_version.minor == 4 and timezone.now() > timezone.datetime(
|
if mysql_version.minor == 4 and datetime.now(timezone.utc) > datetime(
|
||||||
year=2032, month=4, day=30, tzinfo=timezone.utc
|
year=2032, month=4, day=30, tzinfo=timezone.utc
|
||||||
):
|
):
|
||||||
errors.append(
|
errors.append(
|
||||||
@ -224,7 +224,7 @@ def system_package_mysql(app_configs, **kwargs) -> list[CheckMessage]:
|
|||||||
id="allianceauth.checks.A005",
|
id="allianceauth.checks.A005",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif mysql_version.minor == 0 and timezone.now() > timezone.datetime(
|
elif mysql_version.minor == 0 and datetime.now(timezone.utc) > datetime(
|
||||||
year=2026, month=4, day=30, tzinfo=timezone.utc
|
year=2026, month=4, day=30, tzinfo=timezone.utc
|
||||||
):
|
):
|
||||||
errors.append(
|
errors.append(
|
||||||
@ -273,7 +273,7 @@ def system_package_mariadb(app_configs, **kwargs) -> list[CheckMessage]: # noqa
|
|||||||
|
|
||||||
# MariaDB 11
|
# MariaDB 11
|
||||||
if mariadb_version.major == 11:
|
if mariadb_version.major == 11:
|
||||||
if mariadb_version.minor == 4 and timezone.now() > timezone.datetime(
|
if mariadb_version.minor == 4 and datetime.now(timezone.utc) > datetime(
|
||||||
year=2029, month=5, day=19, tzinfo=timezone.utc
|
year=2029, month=5, day=19, tzinfo=timezone.utc
|
||||||
):
|
):
|
||||||
errors.append(
|
errors.append(
|
||||||
@ -295,7 +295,7 @@ def system_package_mariadb(app_configs, **kwargs) -> list[CheckMessage]: # noqa
|
|||||||
|
|
||||||
# MariaDB 10
|
# MariaDB 10
|
||||||
elif mariadb_version.major == 10:
|
elif mariadb_version.major == 10:
|
||||||
if mariadb_version.minor == 11 and timezone.now() > timezone.datetime(
|
if mariadb_version.minor == 11 and datetime.now(timezone.utc) > datetime(
|
||||||
year=2028, month=2, day=10, tzinfo=timezone.utc
|
year=2028, month=2, day=10, tzinfo=timezone.utc
|
||||||
):
|
):
|
||||||
errors.append(
|
errors.append(
|
||||||
@ -305,7 +305,7 @@ def system_package_mariadb(app_configs, **kwargs) -> list[CheckMessage]: # noqa
|
|||||||
id="allianceauth.checks.A014",
|
id="allianceauth.checks.A014",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif mariadb_version.minor == 6 and timezone.now() > timezone.datetime(
|
elif mariadb_version.minor == 6 and datetime.now(timezone.utc) > datetime(
|
||||||
year=2026, month=7, day=6, tzinfo=timezone.utc
|
year=2026, month=7, day=6, tzinfo=timezone.utc
|
||||||
):
|
):
|
||||||
errors.append(
|
errors.append(
|
||||||
@ -315,7 +315,7 @@ def system_package_mariadb(app_configs, **kwargs) -> list[CheckMessage]: # noqa
|
|||||||
id="allianceauth.checks.A0015",
|
id="allianceauth.checks.A0015",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif mariadb_version.minor == 5 and timezone.now() > timezone.datetime(
|
elif mariadb_version.minor == 5 and datetime.now(timezone.utc) > datetime(
|
||||||
year=2025, month=6, day=24, tzinfo=timezone.utc
|
year=2025, month=6, day=24, tzinfo=timezone.utc
|
||||||
):
|
):
|
||||||
errors.append(
|
errors.append(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Generated by Django 1.10.1 on 2016-09-05 22:20
|
# Generated by Django 1.10.1 on 2016-09-05 22:20
|
||||||
|
|
||||||
import datetime
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
@ -15,6 +15,6 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='fatlink',
|
model_name='fatlink',
|
||||||
name='fatdatetime',
|
name='fatdatetime',
|
||||||
field=models.DateTimeField(default=datetime.datetime(2016, 9, 5, 22, 20, 2, 999041, tzinfo=datetime.timezone.utc)),
|
field=models.DateTimeField(default=datetime(2016, 9, 5, 22, 20, 2, 999041, tzinfo=timezone.utc)),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
import datetime
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
from datetime import datetime, timedelta, timezone
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required, permission_required
|
from django.contrib.auth.decorators import login_required, permission_required
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.core.exceptions import ObjectDoesNotExist, ValidationError
|
from django.core.exceptions import ObjectDoesNotExist, ValidationError
|
||||||
from django.shortcuts import get_object_or_404, redirect, render
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
from django.utils import timezone
|
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
@ -135,7 +134,7 @@ def fatlink_statistics_corp_view(request, corpid, year=None, month=None):
|
|||||||
stat_list.sort(key=lambda stat: (stat.n_fats, stat.avg_fat), reverse=True)
|
stat_list.sort(key=lambda stat: (stat.n_fats, stat.avg_fat), reverse=True)
|
||||||
|
|
||||||
context = {'fatStats': stat_list, 'month': start_of_month.strftime("%B"), 'year': year, 'previous_month': start_of_previous_month, 'corpid': corpid}
|
context = {'fatStats': stat_list, 'month': start_of_month.strftime("%B"), 'year': year, 'previous_month': start_of_previous_month, 'corpid': corpid}
|
||||||
if datetime.datetime.now() > start_of_next_month:
|
if datetime.datetime.now(timezone.utc) > start_of_next_month:
|
||||||
context.update({'next_month': start_of_next_month})
|
context.update({'next_month': start_of_next_month})
|
||||||
|
|
||||||
return render(request, 'fleetactivitytracking/fatlinkstatisticscorpview.html', context=context)
|
return render(request, 'fleetactivitytracking/fatlinkstatisticscorpview.html', context=context)
|
||||||
@ -174,7 +173,7 @@ def fatlink_statistics_view(request, year=None, month=None):
|
|||||||
stat_list.sort(key=lambda stat: (stat.n_fats, stat.avg_fat), reverse=True)
|
stat_list.sort(key=lambda stat: (stat.n_fats, stat.avg_fat), reverse=True)
|
||||||
|
|
||||||
context = {'fatStats': stat_list, 'month': start_of_month.strftime("%B"), 'year': year, 'previous_month': start_of_previous_month}
|
context = {'fatStats': stat_list, 'month': start_of_month.strftime("%B"), 'year': year, 'previous_month': start_of_previous_month}
|
||||||
if datetime.datetime.now() > start_of_next_month:
|
if datetime.datetime.now(timezone.utc) > start_of_next_month:
|
||||||
context.update({'next_month': start_of_next_month})
|
context.update({'next_month': start_of_next_month})
|
||||||
|
|
||||||
return render(request, 'fleetactivitytracking/fatlinkstatisticsview.html', context=context)
|
return render(request, 'fleetactivitytracking/fatlinkstatisticsview.html', context=context)
|
||||||
@ -202,7 +201,7 @@ def fatlink_personal_statistics_view(request, year=None):
|
|||||||
|
|
||||||
monthlystats = [(i + 1, datetime.date(year, i + 1, 1).strftime("%h"), monthlystats[i]) for i in range(12)]
|
monthlystats = [(i + 1, datetime.date(year, i + 1, 1).strftime("%h"), monthlystats[i]) for i in range(12)]
|
||||||
|
|
||||||
if datetime.datetime.now() > datetime.datetime(year + 1, 1, 1):
|
if datetime.datetime.now(timezone.utc) > datetime.datetime(year + 1, 1, 1):
|
||||||
context = {'user': user, 'monthlystats': monthlystats, 'year': year, 'previous_year': year - 1, 'next_year': year + 1}
|
context = {'user': user, 'monthlystats': monthlystats, 'year': year, 'previous_year': year - 1, 'next_year': year + 1}
|
||||||
else:
|
else:
|
||||||
context = {'user': user, 'monthlystats': monthlystats, 'year': year, 'previous_year': year - 1}
|
context = {'user': user, 'monthlystats': monthlystats, 'year': year, 'previous_year': year - 1}
|
||||||
@ -272,7 +271,7 @@ def click_fatlink_view(request, token, fat_hash=None):
|
|||||||
if character_online["online"] is True:
|
if character_online["online"] is True:
|
||||||
fatlink = get_object_or_404(Fatlink, hash=fat_hash)
|
fatlink = get_object_or_404(Fatlink, hash=fat_hash)
|
||||||
|
|
||||||
if (timezone.now() - fatlink.fatdatetime) < datetime.timedelta(seconds=(fatlink.duration * 60)):
|
if (datetime.now(timezone.utc) - fatlink.fatdatetime) < timedelta(seconds=(fatlink.duration * 60)):
|
||||||
if character:
|
if character:
|
||||||
# get data
|
# get data
|
||||||
location = c.Location.get_characters_character_id_location(character_id=token.character_id).result()
|
location = c.Location.get_characters_character_id_location(character_id=token.character_id).result()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user