How to fix this error: invalid literal for int() with base 10: 'undefined' and fix possibility for edit in edit function

I tried with int a few days ago and it wasn’t work at all so I wasn’t think this was a problem, and now I changed my staff_edit function to receive the arguments def staff_edit(request, pk): and then I pass to urls.py path('staff/edit/<int:pk>' and now when I click on the action for edit I got Page not found (404) with the url http://192.168.2.85:8000/staff/edit/undefined and don’t get any other error but Page not found.
Do you think the logic in staff_edit is correct?