[Answered ]-How to send url from template to view in django

1👍

You need to escape the image so that it can be used in a URL, use the built-in filter urlencode

    {% url 'imageviewer' theimage=value.image|urlencode %}

Your urlpattern also needs to accept slashes and other chars, use the path converter instead of str as it accepts any non-empty string

path('imageviewer/<path:theimage>', mainviews.imageviewer, name="imageviewer"),

Leave a comment