Hello Django developer,
I want to know if the ID ticket user input matches the ID ticket from modal.py. So here’s what I did: first, I created an HTML input:
<!-- ======== Tickets ======== -->
<div class="ui selection dropdown form-inp" id="inputField">
<input type="hidden" name="ticket">
<i class="dropdown icon"></i>
<div class="text col-form-label">Select Ticket ID</div>
<div class="menu" id="tickets-data-box" name="ticket"></div>
</div>
And then I call it in views.py by using the name="ticket"
:
ticket_log = Tickets.objects.get(ticket_id = request.GET.get('ticket') )
but I got this message:
Exception Type: DoesNotExist
Exception Value: Tickets matching query does not exist
but when I use the same value is correct, it works
ticket_fake = '22020233'
test = request.GET.get('ticket') #-> '22020233'
print("tickest fake" , ticket_fake )
print("ticket input: ", test )
ticket_log = Tickets.objects.get(ticket_id = ticket_fake)
see the below in cmd: