from __future__ import absolute_import, unicode_literals from celery import shared_task from django.utils import timezone from apps.em.models import Equipment @shared_task def update_equip_state_by_next_check_date(): Equipment.objects.filter(next_check_date__lt=timezone.now()).update( state = Equipment.EQUIP_STATE_DISABLE )