I am trying to pass a few variables but I am having some trouble and specifically have 3 questions. How do I encode the url string to take into account the special character
Pass these variables as it is to template, there use url, before sending to template just do this in view.
View.py
related = urllib.quote(related, safe='')
template
<a href="{% url 'path.to.video_player' author video related %}" > <img src="img.png" > </a>
Url.py
url(r'^partner/(?P<author>[-\w]+)/(?P<video>\w+)/(?P<related>\w+)/$', 'video_player'),
EDIT
If you want to go without related parameter, or if there is doubt video can also be None then just do this in your view:
def video_player(request, author, video=None, related=None):
now you can use the url by
<a href="{% url 'path.to.video_player' author video %}" > <img src="img.png" > </a>
in newer versions of python you could simply just type: Example:
path('<int:id>/delete/', delete_view, name = 'delete'),