def time_step2(request): _ip = request.POST["IP"] _time_step2 = request.POST["Time_step2"] try: record = Record.objects(ip=_ip) except DoesNotExist: return HttpResponse(status=400) record.time_step2 = str(_time_step2) record.save()
def new_user(request): _ip = request.POST["IP"] _name = request.POST["Name"] _gender = request.POST["Gender"] _age = request.POST["Age"] _occupation = request.POST["Occupation"] _email = request.POST["Email"] try: record = Record.objects(ip=_ip) except DoesNotExist: return HttpResponse(status=400) record.name = str(_name) record.gender = str(_gender) record.age = int(_age) record.occupation = str(_occupation) record.email = str(_email) record.save()
def check_ip(request): try: exp = Exp.objects(onlyKey=1) except DoesNotExist: exp = Exp() exp.save() _ip = request.POST["IP"] try: record = Record.objects(ip=_ip) except DoesNotExist: exp.count += 1 exp.save() record = Record(ip=_ip, seqNo=exp.count) record.save() if record.time_end is None: return HttpResponse(status=200) else: return HttpResponse(status=400)
def questionnaire(request): _ip = request.POST["IP"] _question1 = request.POST["question1"] _question2 = request.POST["question2"] _question3 = request.POST["question3"] _question4 = request.POST["question4"] _question5 = request.POST["question5"] _question6 = request.POST["question6"] _question7 = request.POST["question7"] _question8a = request.POST["question8a"] _question8b = request.POST["question8b"] _question8c = request.POST["question8c"] _question8d = request.POST["question8d"] _question8e = request.POST["question8e"] _question8f = request.POST["question8f"] _question9a = request.POST["question9a"] _question9b = request.POST["question9b"] _question9c = request.POST["question9c"] _question9d = request.POST["question9d"] _question10 = request.POST["question10"] _question11 = request.POST["question11"] _question12 = request.POST["question12"] _question13 = request.POST["question13"] _question14 = request.POST["question14"] _question15 = request.POST["question15"] _question16 = request.POST["question16"] _question17 = request.POST["question17"] _question18 = request.POST["question18"] _question19 = request.POST["question19"] _question20 = request.POST["question20"] _question21 = request.POST["question21"] _question22 = request.POST["question22"] _question23 = request.POST["question23"] _question24 = request.POST["question24"] _question25 = request.POST["question25"] _question26 = request.POST["question26"] _question27 = request.POST["question27"] _question28 = request.POST["question28"] _habit1 = request.POST["habit1"] _habit2 = request.POST["habit2"] _time_end = request.POST["Time_end"] try: record = Record.objects(ip=_ip) except DoesNotExist: return HttpResponse(status=400) record.question.append(str(_question1)) record.question.append(str(_question2)) record.question.append(str(_question3)) record.question.append(str(_question4)) record.question.append(str(_question5)) record.question.append(str(_question6)) record.question.append(str(_question7)) record.question.append(str(_question8a)) record.question.append(str(_question8b)) record.question.append(str(_question8c)) record.question.append(str(_question8d)) record.question.append(str(_question8e)) record.question.append(str(_question8f)) record.question.append(str(_question9a)) record.question.append(str(_question9b)) record.question.append(str(_question9c)) record.question.append(str(_question9d)) record.question.append(str(_question10)) record.question.append(str(_question11)) record.question.append(str(_question12)) record.question.append(str(_question13)) record.question.append(str(_question14)) record.question.append(str(_question15)) record.question.append(str(_question16)) record.question.append(str(_question17)) record.question.append(str(_question18)) record.question.append(str(_question19)) record.question.append(str(_question20)) record.question.append(str(_question21)) record.question.append(str(_question22)) record.question.append(str(_question23)) record.question.append(str(_question24)) record.question.append(str(_question25)) record.question.append(str(_question26)) record.question.append(str(_question27)) record.question.append(str(_question28)) record.question.append(str(_habit1)) record.question.append(str(_habit2)) record.time_end = str(_time_end) record.save()