Re: Employee matching query does not exist

2022-01-05 Thread Gwanghyeon Gim
Two possible scenarios. 1. self.request.POST doesn't have any key named 'employee_id', so self.request.POST.get('employee_id') returns None 2. self.request.POST.get('employee_id') has value like 'Sam', but Employee model doesn't have any object whose name equals to

Re: Employee matching query does not exist

2022-01-05 Thread Julio Cojom
Hi, Try the following. employee =self.request.POST.get('employee_id') print(employee) obj.employee= Employee.objects.filter(name=employee) It will crash again, but you can see in the console if it's printing the id correctly. I've assume this is a function, not a class view by the way that you

Re: Employee matching query does not exist

2022-01-05 Thread Rey Ondiyo
Django don't saw a employe who have this ID so you can use filter if there's not matching in your database he return [ ]. obj.employee= Employee.objects.filter(name=self.request.POST.get('employee_id')) Le mardi 4 janvier 2022 à 15:44:55 UTC+1, jitendra...@gmail.com a écrit : > name column

Re: Employee matching query does not exist

2022-01-04 Thread Jitendra kumar Patra
name column row's data not matching from database Show that you are getting error . So we use the Expection then you can easily handle the error .. On Tue, 4 Jan 2022, 8:05 pm yassin kamanyile, wrote: > please team ..i got an error from that line below > > obj.employee =

Employee matching query does not exist

2022-01-04 Thread yassin kamanyile
please team ..i got an error from that line below obj.employee = Employee.objects.get(name=self.request.POST.get('employee_id' )) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from