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.
 
 
 
 
 
 

13 lines
441 B

from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from main.models import ProductsUpdate
class Command(BaseCommand):
def handle(self, *args, **options):
p = ProductsUpdate.objects.last()
if not p:
p = ProductsUpdate.objects.create(created=timezone.now())
p.created = timezone.now()
p.save()
self.stdout.write('{}'.format(p.created))