You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
669 B
25 lines
669 B
# -*- coding: utf-8 -*-
|
|
from __future__ import absolute_import
|
|
from datetime import datetime, timedelta
|
|
|
|
from celery import shared_task
|
|
from .models import License, UserProfile
|
|
from .utils import check_one_profile
|
|
|
|
|
|
@shared_task
|
|
def check_license():
|
|
profiles = UserProfile.objects.all()
|
|
now = datetime.today()
|
|
|
|
#licenses = License.objects.filter(date_to__lt=now, status__in=[-1, 2], deleted=False)
|
|
#licenses.update(status=3)
|
|
|
|
licenses = License.objects.filter(order_date__lte=now - timedelta(10), status=0, deleted=False)
|
|
licenses.update(status=4)
|
|
|
|
for profile in profiles:
|
|
check_one_profile(profile, License, now)
|
|
|
|
return None
|
|
|
|
|