我每半小时左右运行一个脚本,比较Job表中的作业状态,如果我查询数据库,我会以这种格式返回结果:
(u'production_assignment', u'22', datetime.datetime(2016, 11, 17, 12, 13, 44,
839672, tzinfo=<UTC>))
无论如何将它转换回表中记录的相同数据样式?
EDIT - OUTPUT(完全不需要像这样先完成小障碍)
class Command(BaseCommand):
# Show this when the user types help
help = "My test command"
# A command must define handle()
def handle(self, *args, **options):
#Job_set = Job.objects.order_by('status').values('status').distinct() PriorityPoints__lte=50
Job_set = Job.objects.filter(ref_number = 36175).values_list('status', 'serial_no', 'due_date')
for jobs in Job_set:
self.stdout.write(jobs)