fix: Use timezone data not native datetime
This commit is contained in:
parent
23d8e85031
commit
1cd70228b9
@ -0,0 +1,24 @@
|
|||||||
|
# Generated by Django 5.1.1 on 2024-10-29 10:44
|
||||||
|
|
||||||
|
import django.utils.timezone
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('fellchensammlung', '0010_timestamp'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='adoptionnotice',
|
||||||
|
name='created_at',
|
||||||
|
field=models.DateField(default=django.utils.timezone.now, verbose_name='Erstellt am'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='adoptionnotice',
|
||||||
|
name='last_checked',
|
||||||
|
field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Zuletzt überprüft am'),
|
||||||
|
),
|
||||||
|
]
|
@ -1,4 +1,4 @@
|
|||||||
from datetime import datetime
|
from django.utils import timezone
|
||||||
from notfellchen.celery import app as celery_app
|
from notfellchen.celery import app as celery_app
|
||||||
from .tools.admin import clean_locations, deactivate_unchecked_adoption_notices
|
from .tools.admin import clean_locations, deactivate_unchecked_adoption_notices
|
||||||
from .tools.misc import healthcheck_ok
|
from .tools.misc import healthcheck_ok
|
||||||
@ -8,9 +8,9 @@ from .models import Location, AdoptionNotice, Timestamp
|
|||||||
def set_timestamp(key: str):
|
def set_timestamp(key: str):
|
||||||
try:
|
try:
|
||||||
ts = Timestamp.objects.get(key=key)
|
ts = Timestamp.objects.get(key=key)
|
||||||
ts.timestamp = datetime.now()
|
ts.timestamp = timezone.now()
|
||||||
except Timestamp.DoesNotExist:
|
except Timestamp.DoesNotExist:
|
||||||
Timestamp.objects.create(key=key, timestamp=datetime.now())
|
Timestamp.objects.create(key=key, timestamp=timezone.now())
|
||||||
|
|
||||||
|
|
||||||
@celery_app.task(name="admin.clean_locations")
|
@celery_app.task(name="admin.clean_locations")
|
||||||
|
Loading…
Reference in New Issue
Block a user