Add weekly new products email and related features

Introduces a weekly summary email for newly added products, including a new email template and Celery periodic task. Adds 'include_in_week_summary_email' to Product and 'newsletter' to CustomUser. Provides an admin endpoint to manually trigger the weekly email, updates Celery Beat schedule, and adds email templates for verification and password reset.
This commit is contained in:
2026-01-22 00:22:21 +01:00
parent c0bd24ee5e
commit 963ba6b824
10 changed files with 308 additions and 7 deletions

View File

@@ -19,6 +19,7 @@ from django.db import OperationalError, connections
from datetime import timedelta
import json
from celery.schedules import crontab
from dotenv import load_dotenv
load_dotenv() # Pouze načte proměnné lokálně, pokud nejsou dostupné
@@ -508,6 +509,14 @@ CELERY_TASK_SERIALIZER = os.getenv("CELERY_TASK_SERIALIZER", "json")
CELERY_RESULT_SERIALIZER = os.getenv("CELERY_RESULT_SERIALIZER", "json")
CELERY_TIMEZONE = os.getenv("CELERY_TIMEZONE", TIME_ZONE)
CELERY_BEAT_SCHEDULER = os.getenv("CELERY_BEAT_SCHEDULER")
# Celery Beat Schedule for periodic tasks
CELERY_BEAT_SCHEDULE = {
'send-weekly-new-items-email': {
'task': 'advertisement.tasks.send_newly_added_items_to_store_email_task_last_week',
'schedule': crontab(hour=9, minute=0, day_of_week=1), # Every Monday at 9:00 AM
},
}
#-------------------------------------END CELERY 📅------------------------------------