from django.core.management.base import BaseCommand
from django.utils.timezone import localdate
from task.models import Task
class Command(BaseCommand):
def handle(self, *args, **kwargs):
today = localdate()
tasks = Task.objects.all()
for task in tasks:
if today > task.date:
task.action = "Suspend"
task.save()
Paste Hosted With By Wklejamy.pl