[Fixed]-How save specific user instance into database using django views

1👍

Try using named groups in your url patterns

urlurl(r'^hod/hod_vacancy/test/part2/inter_list/?P<iid>[0-9]+)/?P<pid>[0-9]+/$', hod_inter_interviewer_2, name="inter2"),

If that doesn’t work then i suggest trying User.object.get(pk=pid) as in most doc examples.

And make sure that there is a user with that id (iid) in the url.

You should also use get_object_or_404 for getting any single object from a model in the view as it gives a more user friendly and appropriate error.

Leave a comment