Example #1
0
def new_run_csid_rftrain(request, cs_id):
	title = 'New RFTrain Card'
	url_form = 'new_run_csid_rftrain'
	template_name = 'cards/_rftrain_form.html'
	func = rftrain_update_create
	form = None
	REVERSE_URL['rftrain']['save_button'].append([cs_id])
	REVERSE_URL['rftrain']['save_and_another'].append([cs_id])
	REVERSE_URL['rftrain']['save_and_continue'].append([cs_id])
	REVERSE_URL['rftrain']['cancel_button'].append([cs_id])

	if request.method == "POST":
		response = get_post(request, RFTrainForm, 'RFTrain Card',
							REVERSE_URL['rftrain'], func, args=True)

		if isinstance(response, HttpResponseRedirect):
			return response
		else:
			form = response
	else:
		form = RFTrainForm()

	data = {
		'title': title,
		'form': form,
		'url_form': url_form,
		'template_name': template_name,
		'cs_id': cs_id,
	}

	return data
Example #2
0
def new_run_csid_mergecsv_edit(request, cs_id, mcsv_id):
	title = 'New MergeCSV Card'
	mergecsv_card = get_object_or_404(MergeCSV, pk=mcsv_id)
	url_form = 'new_run_csid_mergecsv_edit'
	template_name = 'cards/_mergecsv_form.html'
	func = mergecsv_update_create
	form = None
	REVERSE_URL['mergecsv']['save_button'].append([cs_id])
	REVERSE_URL['mergecsv']['save_and_another'].append([cs_id])
	REVERSE_URL['mergecsv']['save_and_continue'].append([cs_id])
	REVERSE_URL['mergecsv']['cancel_button'].append([cs_id])

	if request.method == "POST":
		response = get_post(request, MergeCSVForm, 'MergeCSV Card', REVERSE_URL['mergecsv'],
							func, args=True, item_id=mcsv_id)

		if isinstance(response, HttpResponseRedirect):
			return response
		else:
			form = response
	else:
		form = MergeCSVForm(instance=mergecsv_card)

	data = {
		'title': title,
		'form': form,
		'card_id': mcsv_id,
		'url_form': url_form,
		'template_name': template_name,
		'cs_id': cs_id,
	}

	return data
Example #3
0
def new_run_csid_qrf(request, cs_id):
	# import pdb;pdb.set_trace()
	title = 'New QRF Card'
	url_form = 'new_run_csid_qrf'
	template_name = 'cards/_qrf_form.html'
	func = qrf_update_create
	form = None
	REVERSE_URL['qrf']['save_button'].append([cs_id])
	REVERSE_URL['qrf']['save_and_another'].append([cs_id])
	REVERSE_URL['qrf']['save_and_continue'].append([cs_id])
	REVERSE_URL['qrf']['cancel_button'].append([cs_id])

	if request.method == "POST":
		# import pdb;pdb.set_trace()
		response = get_post(request, QRFForm, 'QRF Card',
							REVERSE_URL['qrf'], func, args=True)

		if isinstance(response, HttpResponseRedirect):
			return response
		else:
			form = response
	else:
		form = QRFForm()

	data = {
		'title': title,
		'form': form,
		'url_form': url_form,
		'template_name': template_name,
		'cs_id': cs_id,
	}

	return data
Example #4
0
def new_run_csid_preproc_edit(request, cs_id, preproc_id):
	title = 'New PreProc Card'
	preproc_card = get_object_or_404(PreProc, pk=preproc_id)
	url_form = 'new_run_csid_preproc_edit'
	template_name = 'cards/_preproc_form.html'
	func = preproc_update_create
	form = None
	REVERSE_URL['preproc']['save_button'].append([cs_id])
	REVERSE_URL['preproc']['save_and_another'].append([cs_id])
	REVERSE_URL['preproc']['save_and_continue'].append([cs_id])
	REVERSE_URL['preproc']['cancel_button'].append([cs_id])

	if request.method == "POST":
		response = get_post(request, PreProcForm, 'PreProc Card',
							REVERSE_URL['preproc'],
							func, args=True, item_id=preproc_id)

		if isinstance(response, HttpResponseRedirect):
			return response
		else:
			form = response
	else:
		form = PreProcForm(instance=preproc_card)

	data = {
		'title': title,
		'form': form,
		'card_id': preproc_id,
		'url_form': url_form,
		'template_name': template_name,
		'cs_id': cs_id,
	}

	return data
Example #5
0
def new_run_csid_year_filter_edit(request, cs_id, yf_id):
	title = 'New YearFilter Card'
	year_filter_card = get_object_or_404(YearFilter, pk=yf_id)
	url_form = 'new_run_csid_year_filter_edit'
	template_name = 'cards/_year_filter_form.html'
	func = year_filter_update_create
	form = None
	REVERSE_URL['year_filter']['save_button'].append([cs_id])
	REVERSE_URL['year_filter']['save_and_another'].append([cs_id])
	REVERSE_URL['year_filter']['save_and_continue'].append([cs_id])
	REVERSE_URL['year_filter']['cancel_button'].append([cs_id])

	if request.method == "POST":
		response = get_post(request, YearFilterForm, 'YearFilter Card',
							REVERSE_URL['year_filter'], func, args=True, item_id=yf_id)

		if isinstance(response, HttpResponseRedirect):
			return response
		else:
			form = response
	else:
		form = YearFilterForm(instance=year_filter_card)

	data = {
		'title': title,
		'form': form,
		'card_id': yf_id,
		'url_form': url_form,
		'template_name': template_name,
		'cs_id': cs_id,
	}

	return data
def cs_runid_csid_calcstats_edit(request, run_id, cs_id, card_id, calcstats_id):
	title = 'CalcStats Card Edit'
	calcstats_card = get_object_or_404(CalcStats, pk=calcstats_id)
	content_type = get_object_or_404(ContentType, app_label='cards', model='calcstats')
	card_sequence = get_object_or_404(CardSequence, pk=cs_id)

	try:
		card_item = get_object_or_404(CardItem, object_id=calcstats_id, content_type=content_type)
		card_sequence_card = CardSequence.cards.through.objects.get(id=card_id)

		url_form = 'cs_runid_csid_calcstats_edit'
		template_name = 'gsi/_cs_calcstats_form.html'
		func = calcstats_update_create
		form_1 = CardSequenceCardForm(instance=card_sequence_card)
		form_2 = CalcStatsForm(instance=calcstats_card)

		REVERSE_URL = {
			'calcstats': {'save_button': ['card_sequence_update'],
							 'save_and_continue': ['cs_runid_csid_calcstats_edit'],
							 'cancel_button': ['card_sequence_update']}
		}
		REVERSE_URL['calcstats']['save_button'].append([run_id, cs_id])
		REVERSE_URL['calcstats']['save_and_continue'].append([run_id, cs_id, card_id])
		REVERSE_URL['calcstats']['cancel_button'].append([run_id, cs_id])

		if request.method == "POST":
			cs_form = [CardSequenceCardForm, card_sequence_card, card_item]
			response = get_post(request, CalcStatsForm, 'CalcStats Card', REVERSE_URL['calcstats'],
								func, args=True, item_id=calcstats_id, cs_form=cs_form)

			if response == None:
				return HttpResponseRedirect(
					u'%s?danger_message=%s' % (reverse('cs_runid_csid_calcstats_edit', args=[run_id, cs_id, card_id, calcstats_id]),
											   (u"CalcStats Card with the same name already exists"))
				)

			if isinstance(response, HttpResponseRedirect):
				return response
			else:
				form_2 = response
	except ObjectDoesNotExist:
		return HttpResponseRedirect(
			u'%s?danger_message=%s' % (reverse('card_sequence_update', args=[run_id, cs_id]),
									   (u'The CalcStats Card "{0}" was removed from Card Sequence "{1}"'.format(
										   randomforest_card.name, card_sequence.name)
									   )))

	data = {
		'title': title,
		'form_1': form_1,
		'form_2': form_2,
		'card_id': calcstats_id,
		'url_form': url_form,
		'template_name': template_name,
		'run_id': run_id,
		'cs_id': cs_id,
		'card': card_id,
	}

	return data
Example #7
0
def new_run_csid_qrf_edit(request, cs_id, qrf_id):
	title = 'New QRF Card'
	qrf_card = get_object_or_404(QRF, pk=qrf_id)
	url_form = 'new_run_csid_qrf_edit'
	template_name = 'cards/_qrf_form.html'
	func = qrf_update_create
	form = None
	REVERSE_URL['qrf']['save_button'].append([cs_id])
	REVERSE_URL['qrf']['save_and_another'].append([cs_id])
	REVERSE_URL['qrf']['save_and_continue'].append([cs_id])
	REVERSE_URL['qrf']['cancel_button'].append([cs_id])

	if request.method == "POST":
		response = get_post(request, QRFForm, 'QRF Card', REVERSE_URL['qrf'],
							func, args=True, item_id=qrf_id)

		if isinstance(response, HttpResponseRedirect):
			return response
		else:
			form = response
	else:
		form = QRFForm(instance=qrf_card)

	data = {
		'title': title,
		'form': form,
		'card_id': qrf_id,
		'url_form': url_form,
		'template_name': template_name,
		'cs_id': cs_id,
	}

	return data
def new_runid_csid_year_filter_edit(request, run_id, cs_id, yf_id):
    title = "New YearFilter Card"
    year_filter_card = get_object_or_404(YearFilter, pk=yf_id)
    url_form = "new_runid_csid_year_filter_edit"
    template_name = "cards/_year_filter_form.html"
    func = year_filter_update_create
    form = None
    REVERSE_URL["year_filter"]["save_button"].append([run_id, cs_id])
    REVERSE_URL["year_filter"]["save_and_another"].append([run_id, cs_id])
    REVERSE_URL["year_filter"]["save_and_continue"].append([run_id, cs_id])
    REVERSE_URL["year_filter"]["cancel_button"].append([run_id, cs_id])

    if request.method == "POST":
        response = get_post(
            request, YearFilterForm, "YearFilter Card", REVERSE_URL["year_filter"], func, args=True, item_id=yf_id
        )

        if isinstance(response, HttpResponseRedirect):
            return response
        else:
            form = response
    else:
        form = YearFilterForm(instance=year_filter_card)

    data = {
        "title": title,
        "form": form,
        "card_id": yf_id,
        "url_form": url_form,
        "template_name": template_name,
        "run_id": run_id,
        "cs_id": cs_id,
    }

    return data
def new_runid_csid_calcstats_edit(request, run_id, cs_id, calcstats_id):
    title = "New CalcStats Card"
    calcstats_card = get_object_or_404(CalcStats, pk=calcstats_id)
    url_form = "new_runid_csid_calcstats_edit"
    template_name = "cards/_calcstats_form.html"
    func = calcstats_update_create
    form = None
    REVERSE_URL["calcstats"]["save_button"].append([run_id, cs_id])
    REVERSE_URL["calcstats"]["save_and_another"].append([run_id, cs_id])
    REVERSE_URL["calcstats"]["save_and_continue"].append([run_id, cs_id])
    REVERSE_URL["calcstats"]["cancel_button"].append([run_id, cs_id])

    if request.method == "POST":
        response = get_post(
            request, CalcStatsForm, "CalcStats Card", REVERSE_URL["calcstats"], func, args=True, item_id=calcstats_id
        )

        if isinstance(response, HttpResponseRedirect):
            return response
        else:
            form = response
    else:
        form = CalcStatsForm(instance=calcstats_card)

    data = {
        "title": title,
        "form": form,
        "url_form": url_form,
        "template_name": template_name,
        "run_id": run_id,
        "card_id": calcstats_id,
        "cs_id": cs_id,
    }

    return data
def new_runid_csid_randomforest_edit(request, run_id, cs_id, rf_id):
    title = "New RandomForest Card"
    randomforest_card = get_object_or_404(RandomForest, pk=rf_id)
    url_form = "new_runid_csid_randomforest_edit"
    template_name = "cards/_randomforest_form.html"
    func = randomforest_update_create
    form = None
    REVERSE_URL["randomforest"]["save_button"].append([run_id, cs_id])
    REVERSE_URL["randomforest"]["save_and_another"].append([run_id, cs_id])
    REVERSE_URL["randomforest"]["save_and_continue"].append([run_id, cs_id])
    REVERSE_URL["randomforest"]["cancel_button"].append([run_id, cs_id])

    if request.method == "POST":
        response = get_post(
            request, RandomForestForm, "RandomForest Card", REVERSE_URL["randomforest"], func, args=True, item_id=rf_id
        )

        if isinstance(response, HttpResponseRedirect):
            return response
        else:
            form = response
    else:
        form = RandomForestForm(instance=randomforest_card)

    data = {
        "title": title,
        "form": form,
        "url_form": url_form,
        "template_name": template_name,
        "run_id": run_id,
        "card_id": rf_id,
        "cs_id": cs_id,
    }

    return data
def new_runid_csid_mergecsv_edit(request, run_id, cs_id, mcsv_id):
    title = "New MergeCSV Card"
    mergecsv_card = get_object_or_404(MergeCSV, pk=mcsv_id)
    url_form = "new_runid_csid_mergecsv_edit"
    template_name = "cards/_mergecsv_form.html"
    func = mergecsv_update_create
    form = None
    REVERSE_URL["mergecsv"]["save_button"].append([run_id, cs_id])
    REVERSE_URL["mergecsv"]["save_and_another"].append([run_id, cs_id])
    REVERSE_URL["mergecsv"]["save_and_continue"].append([run_id, cs_id])
    REVERSE_URL["mergecsv"]["cancel_button"].append([run_id, cs_id])

    if request.method == "POST":
        response = get_post(
            request, MergeCSVForm, "MergeCSV Card", REVERSE_URL["mergecsv"], func, args=True, item_id=mcsv_id
        )

        if isinstance(response, HttpResponseRedirect):
            return response
        else:
            form = response
    else:
        form = MergeCSVForm(instance=mergecsv_card)

    data = {
        "title": title,
        "form": form,
        "card_id": mcsv_id,
        "url_form": url_form,
        "template_name": template_name,
        "run_id": run_id,
        "cs_id": cs_id,
    }

    return data
def new_runid_csid_preproc_edit(request, run_id, cs_id, preproc_id):
    title = "New PreProc Card"
    preproc_card = get_object_or_404(PreProc, pk=preproc_id)
    url_form = "new_runid_csid_preproc_edit"
    template_name = "cards/_preproc_form.html"
    func = preproc_update_create
    form = None
    REVERSE_URL["preproc"]["save_button"].append([run_id, cs_id])
    REVERSE_URL["preproc"]["save_and_another"].append([run_id, cs_id])
    REVERSE_URL["preproc"]["save_and_continue"].append([run_id, cs_id])
    REVERSE_URL["preproc"]["cancel_button"].append([run_id, cs_id])

    if request.method == "POST":
        response = get_post(
            request, PreProcForm, "PreProc Card", REVERSE_URL["preproc"], func, args=True, item_id=preproc_id
        )

        if isinstance(response, HttpResponseRedirect):
            return response
        else:
            form = response
    else:
        form = PreProcForm(instance=preproc_card)

    data = {
        "title": title,
        "form": form,
        "card_id": preproc_id,
        "url_form": url_form,
        "template_name": template_name,
        "run_id": run_id,
        "cs_id": cs_id,
    }

    return data
def new_runid_csid_collate_edit(request, run_id, cs_id, collate_id):
    title = "New Collate Card"
    collate_card = get_object_or_404(Collate, pk=collate_id)
    url_form = "new_runid_csid_collate_edit"
    template_name = "cards/_collate_form.html"
    func = collate_update_create
    form = None
    # update_list_files(collate_card.input_data_directory)

    available_files = ListTestFiles.objects.filter(input_data_directory=collate_card.input_data_directory).exclude(
        id__in=collate_card.input_files.values_list("id", flat=True)
    )
    chosen_files = collate_card.input_files.filter(input_data_directory=collate_card.input_data_directory)
    available_files = available_files.order_by("name")
    chosen_files = chosen_files.order_by("name")

    REVERSE_URL["collate"]["save_button"].append([run_id, cs_id])
    REVERSE_URL["collate"]["save_and_another"].append([run_id, cs_id])
    REVERSE_URL["collate"]["save_and_continue"].append([run_id, cs_id])
    REVERSE_URL["collate"]["cancel_button"].append([run_id, cs_id])

    if request.method == "POST":
        if request.POST.get("update_data") is not None:
            update_list_files(collate_card.input_data_directory)

        response = get_post(
            request, CollateForm, "Collate Card", REVERSE_URL["collate"], func, args=True, item_id=collate_id
        )

        if isinstance(response, HttpResponseRedirect):
            return response
        else:
            form = response
    else:
        form = CollateForm(instance=collate_card)

    data = {
        "title": title,
        "form": form,
        "card_id": collate_id,
        "url_form": url_form,
        "template_name": template_name,
        "run_id": run_id,
        "cs_id": cs_id,
        "available_files": available_files,
        "chosen_files": chosen_files,
    }

    return data
def new_runid_csid_collate(request, run_id, cs_id):
    title = "New Collate Card"
    url_form = "new_runid_csid_collate"
    template_name = "cards/_collate_form.html"
    # update_root_list_files()
    func = collate_update_create
    form = None
    available_files = ListTestFiles.objects.filter(input_data_directory=None)
    available_files = available_files.order_by("name")
    REVERSE_URL["collate"]["save_button"].append([run_id, cs_id])
    REVERSE_URL["collate"]["save_and_another"].append([run_id, cs_id])
    REVERSE_URL["collate"]["save_and_continue"].append([run_id, cs_id])
    REVERSE_URL["collate"]["cancel_button"].append([run_id, cs_id])

    if request.method == "POST":
        if request.POST.get("update_data") is not None:
            update_root_list_files()

        response = get_post(request, CollateForm, "Collate Card", REVERSE_URL["collate"], func, args=True, cs_id=cs_id)

        if response == None:
            return HttpResponseRedirect(
                u"%s?danger_message=%s"
                % (
                    reverse("new_runid_csid_collate", args=[run_id, cs_id]),
                    (u"Collate Card with the same name already exists"),
                )
            )

        if isinstance(response, HttpResponseRedirect):
            return response
        else:
            form = response
    else:
        form = CollateForm()

    data = {
        "title": title,
        "form": form,
        "url_form": url_form,
        "template_name": template_name,
        "run_id": run_id,
        "cs_id": cs_id,
        "available_files": available_files,
    }

    return data
def cs_run_csid_qrf_edit(request, cs_id, qrf_id):
	title = 'QRF Card Edit'
	qrf_card = get_object_or_404(QRF, pk=qrf_id)
	content_type = get_object_or_404(ContentType, app_label='cards', model='qrf')
	card_item = get_object_or_404(CardItem, object_id=qrf_id, content_type=content_type)
	card_sequence = get_object_or_404(CardSequence, pk=cs_id)

	card_sequence_card_all = CardSequence.cards.through.objects.filter(
							card_item=card_item,
							sequence=card_sequence
						)
	card_sequence_card = card_sequence_card_all[0]

	url_form = 'cs_run_csid_qrf_edit'
	template_name = 'gsi/_cs_qrf_form.html'
	func = qrf_update_create
	form_1 = None
	form_2 = None
	REVERSE_URL['qrf']['save_button'].append([cs_id])
	REVERSE_URL['qrf']['save_and_continue'].append([cs_id])
	REVERSE_URL['qrf']['cancel_button'].append([cs_id])

	if request.method == "POST":
		cs_form = [CardSequenceCardForm, card_sequence_card, card_item]
		response = get_post(request, QRFForm, 'QRF Card', REVERSE_URL['qrf'],
							func, args=True, item_id=qrf_id, cs_form=cs_form)

		if isinstance(response, HttpResponseRedirect):
			return response
		else:
			form_2 = response
	else:
		form_1 = CardSequenceCardForm(instance=card_sequence_card)
		form_2 = QRFForm(instance=qrf_card)

	data = {
		'title': title,
		'form_1': form_1,
		'form_2': form_2,
		'card_id': qrf_id,
		'url_form': url_form,
		'template_name': template_name,
		'cs_id': cs_id,
	}

	return data
def new_runid_csid_calcstats(request, run_id, cs_id):
    title = "New CalcStats Card"
    url_form = "new_runid_csid_calcstats"
    template_name = "cards/_calcstats_form.html"
    func = calcstats_update_create
    form = None
    REVERSE_URL["calcstats"]["save_button"].append([run_id, cs_id])
    REVERSE_URL["calcstats"]["save_and_another"].append([run_id, cs_id])
    REVERSE_URL["calcstats"]["save_and_continue"].append([run_id, cs_id])
    REVERSE_URL["calcstats"]["cancel_button"].append([run_id, cs_id])

    if request.method == "POST":
        response = get_post(
            request, CalcStatsForm, "CalcStats Card", REVERSE_URL["calcstats"], func, args=True, cs_id=cs_id
        )

        if response == None:
            return HttpResponseRedirect(
                u"%s?danger_message=%s"
                % (
                    reverse("new_runid_csid_calcstats", args=[run_id, cs_id]),
                    (u"CalcStats Card with the same name already exists"),
                )
            )

        if isinstance(response, HttpResponseRedirect):
            return response
        else:
            form = response
    else:
        form = CalcStatsForm()

    data = {
        "title": title,
        "form": form,
        "url_form": url_form,
        "template_name": template_name,
        "run_id": run_id,
        "cs_id": cs_id,
    }

    return data
def new_runid_csid_qrf(request, run_id, cs_id):
    # import pdb;pdb.set_trace()
    title = "New QRF Card"
    url_form = "new_runid_csid_qrf"
    template_name = "cards/_qrf_form.html"
    func = qrf_update_create
    form = None
    REVERSE_URL["qrf"]["save_button"].append([run_id, cs_id])
    REVERSE_URL["qrf"]["save_and_another"].append([run_id, cs_id])
    REVERSE_URL["qrf"]["save_and_continue"].append([run_id, cs_id])
    REVERSE_URL["qrf"]["cancel_button"].append([run_id, cs_id])

    if request.method == "POST":
        # import pdb;pdb.set_trace()
        response = get_post(request, QRFForm, "QRF Card", REVERSE_URL["qrf"], func, args=True, cs_id=cs_id)

        if response == None:
            return HttpResponseRedirect(
                u"%s?danger_message=%s"
                % (reverse("new_runid_csid_qrf", args=[run_id, cs_id]), (u"QRF Card with the same name already exists"))
            )

        if isinstance(response, HttpResponseRedirect):
            return response
        else:
            form = response
            # if request.POST.get('save_button') is not None:

    else:
        form = QRFForm()

    data = {
        "title": title,
        "form": form,
        "url_form": url_form,
        "template_name": template_name,
        "run_id": run_id,
        "cs_id": cs_id,
    }

    return data
def cs_runid_csid_collate_edit(request, run_id, cs_id, card_id, collate_id):
	title = 'Collate Card Edit'
	collate_card = get_object_or_404(Collate, pk=collate_id)
	content_type = get_object_or_404(ContentType, app_label='cards', model='collate')
	card_sequence = get_object_or_404(CardSequence, pk=cs_id)
	# update_list_files(collate_card.input_data_directory)

	available_files = ListTestFiles.objects.filter(
			input_data_directory=collate_card.input_data_directory).exclude(
			id__in=collate_card.input_files.values_list('id', flat=True))
	chosen_files = collate_card.input_files.filter(input_data_directory=collate_card.input_data_directory)

	available_files = available_files.order_by('name')
	chosen_files = chosen_files.order_by('name')

	try:
		card_item = get_object_or_404(CardItem, object_id=collate_id, content_type=content_type)
		card_sequence_card = CardSequence.cards.through.objects.get(id=card_id)

		url_form = 'cs_runid_csid_collate_edit'
		template_name = 'gsi/_cs_collate_form.html'
		func = collate_update_create
		form_1 = CardSequenceCardForm(instance=card_sequence_card)
		form_2 = CollateForm(instance=collate_card)

		REVERSE_URL = {
			'collate': {'save_button': ['card_sequence_update'],
						'save_and_continue': ['cs_runid_csid_collate_edit'],
						'cancel_button': ['card_sequence_update']},
		}
		REVERSE_URL['collate']['save_button'].append([run_id, cs_id])
		REVERSE_URL['collate']['save_and_continue'].append([run_id, cs_id, card_id])
		REVERSE_URL['collate']['cancel_button'].append([run_id, cs_id])

		if request.method == "POST":
			if request.POST.get('update_data') is not None:
				update_list_files(collate_card.input_data_directory)

			cs_form = [CardSequenceCardForm, card_sequence_card, card_item]
			response = get_post(request, CollateForm, 'Collate Card', REVERSE_URL['collate'],
								func, args=True, item_id=collate_id, cs_form=cs_form)

			if response == None:
				return HttpResponseRedirect(
					u'%s?danger_message=%s' % (reverse('cs_runid_csid_collate_edit', args=[run_id, cs_id, card_id, collate_id]),
											   (u"Collate Card with the same name already exists"))
				)

			if isinstance(response, HttpResponseRedirect):
				return response
			else:
				form_2 = response
	except ObjectDoesNotExist:
		return HttpResponseRedirect(
			u'%s?danger_message=%s' % (reverse('card_sequence_update', args=[run_id, cs_id]),
									   (u'The RFTrain Card "{0}" was removed from Card Sequence "{1}"'.format(
										   collate_card.name, card_sequence.name)
									   )))

	data = {
		'title': title,
		'form_1': form_1,
		'form_2': form_2,
		'card_id': collate_id,
		'url_form': url_form,
		'template_name': template_name,
		'run_id': run_id,
		'cs_id': cs_id,
		'card': card_id,
		'available_files': available_files,
		'chosen_files': chosen_files,
	}

	return data