Just glue the netloc and path together rather than using urlunparse - it doesn't need to be a valid URL, just a nice-looking one

This commit is contained in:
Danielle McLean 2017-10-30 15:02:49 +11:00
parent 71295e30f0
commit 76305543fa
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5

View file

@ -1,5 +1,5 @@
from django import template
from urllib.parse import urlunparse, urlparse
from urllib.parse import urlparse
register = template.Library()
@ -7,4 +7,4 @@ register = template.Library()
@register.filter
def friendly_url(url):
(scheme, netloc, path, params, q, fragment) = urlparse(url)
return urlunparse(('', netloc, path, '', '', ''))
return netloc + path