def transform_job_type(self, request, queryset): for inst in queryset.all(): i = 0 for rj in JobDao.recurings_by_type(inst.id): oj = OneTimeJob() attribute_copy(inst, oj) attribute_copy(rj, oj) oj.name += str(i) i += 1 oj.save() for b in AssignmentDao.assignments_for_job(rj.id): b.job = oj b.save() rj.delete() inst.delete()
def transform_job(self, request, queryset): for inst in queryset.all(): t = JobType() rj = RecuringJob() attribute_copy(inst, t) attribute_copy(inst, rj) name = t.name t.name = 'something temporal which possibly is never used' t.save() rj.type = t rj.save() for b in AssignmentDao.assignments_for_job(inst.id): b.job = rj b.save() inst.delete() t.name = name t.save()