def pt_job_all_html(request, project_id): if request.method == 'POST': f = PTJobUploadForm(request.POST, request.FILES) if f.is_valid(): try: project = ProjectModel.objects.get(id=project_id) except ProjectModel.DoesNotExist: raise Http404 try: data = request.FILES['job_file'].read() ret = _pt_upload_job_json( data, job_title=f.cleaned_data['job_title'].strip(), project_name=project.name) msg = ret.content.decode('utf-8') messages.success( request, msg ) if ret.status_code == http.client.OK else messages.error( request, msg) except UnicodeDecodeError as e: messages.error(request, "can't decode json file") else: messages.error(request, 'Upload failed: ' + f.errors.as_text()) return HttpResponseRedirect(request.get_full_path()) params = { 'cmp_form': PTCmpDialogForm(), 'hw_lock_form': PTHwFarmNodeLockForm(), 'hw_lock_types': HwFarmNodeLockTypeModel.pt_get_all(), 'hw_lock_timeline': HwFarmNodesLocksTimeline(project_id).gen_html() } return pt_base_html(request, project_id, 'job_all.html', params=params)
def pt_hwfarm_all_html(request, project_id): params = { 'hw_lock_form': PTHwFarmNodeLockForm(), 'timeline': HwFarmNodesTimeline(project_id).gen_html() } return pt_base_html(request, project_id, 'hw_farm_node_all.html', params=params)