Esempio n. 1
0
	def mark_row_for_deletion(job, row_id, checked, force=True):
		"""Mark row for deletion in the database."""
		# try:
		# 	result = EditedResult.objects.get(job=job, local_id=row_id)
		# 	if force:
		# 		result.value = checked
		# 		result.save()
		# except EditedResult.DoesNotExist:
		result = EditedResult(job=job, local_id=row_id, value=checked)
		result.save()					
Esempio n. 2
0
def save_edits(job, request):
	"""Save user result edits to database."""
	for k, v in request.POST.items():
		if not (re.match("\d+-\d+", k) or re.match("\d+", k)):
			continue
		try:
			result = EditedResult.objects.get(job=job, local_id=k)
			result.value = request.POST['%s' % str(result.local_id)]
			result.save()
		except EditedResult.DoesNotExist:
			result = EditedResult(job=job, local_id=k, value=v)
			result.save()