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.
18 lines
518 B
18 lines
518 B
from datetime import timedelta
|
|
|
|
from django.core.management.base import BaseCommand
|
|
from django.db.models import F
|
|
|
|
from apps.payment.models import CoursePayment
|
|
|
|
|
|
class Command(BaseCommand):
|
|
help = 'Fill payment.access_expire where it is not filled'
|
|
|
|
def handle(self, *args, **options):
|
|
|
|
for payment in CoursePayment.objects.filter(access_expire__isnull=True):
|
|
payment.access_expire = payment.created_at.date() + timedelta(days=payment.course.access_duration)
|
|
payment.save()
|
|
|
|
|
|
|