How do I pass variables in django through the url?

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'),