1👍
✅
You are using the string "model1_object"
instead of the variable model1_object
. Try:
reverse("app:view", kwargs={"model1_id": model1_object})
Note that you can simplify your code by using the redirect
shortcut instead of reverse
and HttpResponseRedirect
:
from django.shortcuts import redirect
return redirect("app:view", model1_id=model1_object)
Source:stackexchange.com