I have an app that is working fine, but i just changed the ID to UUIDm and the route no longer work. I have the following route:
path("documents/uuid:uuid/",views.document_show, name="document_show"),
and the following view:
def document_show(request, id):
student_list = DocumentAttachment.objects.all()
for student in student_list:
print("we are printing the list of imaged uploaded :", student.attachment)
context = {}
try:
context["data"] = Document.objects.get(id=id)
except Document.DoesNotExist:
raise Http404('Book does not exist')
return render(request, "documents/show.html", context)
With the architecture: template/documents/show.html
May I ask what is the right way to setup the routes please?
TypeError: document_show() got an unexpected keyword argument 'uuid'? did you update your view function asdocument_show(request, uuid)? If you did likely you forgot to update this lineDocument.objects.get(id=id)