def create_job_assignment(job, computer, project, params=None): assignment = JobAssignment( job = job.model, project = project, computer = computer, ).get_domain_object() assignment.create_config(params) assignment.model.version = assignment.job_version assignment.model.save() if len(ProjectClient.objects.filter(project=project, computer=computer)) == 0: client = ProjectClient(project=project, computer=computer) client.generate_password() client.save() return assignment