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.
 
 
 
 
 
 

12 lines
389 B

from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils import timezone
from .models import Stage, Order
@receiver(post_save, sender=Stage)
def set_approve_time(sender, instance, created, **kwargs):
if instance.status == 'in_process' and not instance.approve_time:
instance.approve_time = timezone.now()
instance.save()