You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
xmrauctions/items/tasks/notifications.py

21 lines
684 B
Python

from logging import getLogger
from huey import crontab
from huey.contrib.djhuey import periodic_task
from core.helpers.email_template import EmailTemplate
from items.models import Item
logger = getLogger('django.server')
@periodic_task(crontab(minute='0', hour='0', day='*/2'))
def notify_seller_of_item_bids():
items = Item.objects.all()
for item in items:
if len(item.bids.all()) > 0:
logger.info(f'[INFO] Item #{item.id} has some bids. Notifying the seller.')
email_template = EmailTemplate(
item=item,
scenario='item_has_bids',
role='seller'
)
email_template.send()