[Answer]-Django: invalid literal for int() with base 10: 'new_patient'

1👍

The problem is that your regexp for show_patient is too broad, and is listed before your new_patient url pattern. Django uses the first matching URL pattern, and http://127.0.0.1/new_patient/ is matched by r'^(?P<patient_id>\w+)/$'. You can either list all your non-show patterns first, or (my recommendation) put something more distinctive in the show patient pattern, eg ^show/(?P<patient_id>\w+)/$.

Leave a comment