first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 22:26:46 +03:00
commit 2be3a313ad
55 changed files with 3609 additions and 0 deletions

16
accounts/tasks.py Normal file
View File

@@ -0,0 +1,16 @@
from celery import shared_task
from django.contrib.auth import get_user_model
from django.utils import timezone
@shared_task(name='accounts.tasks.deactivate_expired_users_task')
def deactivate_expired_users_task():
"""Deactivate active users whose active_until timestamp has passed."""
user_model = get_user_model()
now = timezone.now()
updated = user_model.objects.filter(
is_active=True,
active_until__isnull=False,
active_until__lte=now,
).update(is_active=False)
return updated