Dear Sir
Please find the below code. I am trying to value from input value but return NONE.
HTML CODE: Button for edit the documents
Text AREA: Enter any value but retrun NONE
<label >Comments:</label>
{% if request.user.email == applicant_bank.pendingwith %}
<a href="{% url 'approvedbank' uuid=applicant_bank.uuid %}" class="btn btn-primary">Approve</a>
<a href="{% url 'rejectbank' uuid=applicant_bank.uuid %}" class="btn btn-danger">Reject</a>
{% endif %}
<a href="{% url 'letter_dashboard' %}" class="btn btn-secondary">Cancel</a>
</div>
<!--End Here Action Button-->
views.py code:
@login_required(login_url=‘login’)
def aa_approve_bankletter(request,uuid):
if request.POST:
print(’*******************’)
comments1 = request.POST.get(“comments”) //return value NONE
print(comments1)
applicant_pass = bank_letter.objects.get(uuid=uuid)
if request.user.is_authenticated:
if bank_letter.objects.filter(Q(pendingwith=request.user.email) & Q(status=1)).exists():
applicant_pass.pendingwith = applicant_pass.level2
applicant_pass.status = 2
applicant_pass.reason = "Approved by HR"
applicant_pass.logs = applicant_pass.logs+"<br>"+"<b>Approved By :</b>" + \
str(request.user.username)+" at: " + str(formatedDate) + "<b>Forwarded To :</b>" + \
"<br>"+str(applicant_pass.level2)+"<br>" + \
"<b>Comments: </b>" + str(comments)
elif bank_letter.objects.filter(Q(pendingwith=request.user.email) & Q(status=2)).exists():
applicant_pass.pendingwith = applicant_pass.level3
applicant_pass.status = 3
applicant_pass.reason = "Approved by Line Manager"
applicant_pass.logs = applicant_pass.logs+"<br>"+"<b>Approved By :</b>" + \
str(request.user.username)+" at: " + str(formatedDate)+"<br>"+"<b>Forwarded To :</b>" + \
"<br>"+str(applicant_pass.level3) + \
"<b>Comments: </b>" + str("comments")
elif bank_letter.objects.filter(Q(pendingwith=request.user.email) & Q(status=3)).exists():
applicant_pass.pendingwith = str("Status Approved")
applicant_pass.status = 6
applicant_pass.reason = str("Approved by Final Approver")
applicant_pass.logs = applicant_pass.logs+"<br>"+"<b>Final Approved By :</b>" + \
str(request.user.username)+" at: " + str(formatedDate) + \
"<br>"+"<b>Comments: </b>" + str(comments)
# applicant_pass.save()
messages.success(request, "Request has been approved successfully.")
return HttpResponseRedirect(reverse('letter_dashboard'))