def secret_post(request): """Function left for legacy reasons. TODO: remove after db migration""" response_data = {} status = 400 if request.method == "POST": print request.POST.items() response_data['result'] = 'OK' status = 200 try: point = DataPoint( node_id = request.POST.get('node_id'), temperature = request.POST.get('temperature'), rh = request.POST.get('rh'), dylos_bin_1 = request.POST.get('dylos_bin_1'), dylos_bin_2 = request.POST.get('dylos_bin_2'), dylos_bin_3 = request.POST.get('dylos_bin_3'), dylos_bin_4 = request.POST.get('dylos_bin_4'), alphasense_1 = request.POST.get('alphasense_1'), alphasense_2 = request.POST.get('alphasense_2'), alphasense_3 = request.POST.get('alphasense_3'), alphasense_4 = request.POST.get('alphasense_4'), alphasense_5 = request.POST.get('alphasense_5'), alphasense_6 = request.POST.get('alphasense_6'), alphasense_7 = request.POST.get('alphasense_7'), alphasense_8 = request.POST.get('alphasense_8'), reading_time = request.POST.get('reading_time')) point.save() except Exception as e: response_data['result'] = 'FAILED' response_data['msg'] = str(e) status = 400 return HttpResponse(json.dumps(response_data), content_type="application/json", status=status)
def setUp(self): self.client = Client() new_user = get_user_model().objects.create_user(**USER) new_user.save() new_data = DataPoint(**DATA_POINT) new_data.save()
def setUp(self): new_data = DataPoint(**DATA_POINT) new_data.save() new_error = ErrorReport(molecule="CON_24a", email="*****@*****.**", urgency=1, message="This is a message") new_error.save()