From 18a2272e32bfdc524723ce5b658a37f4c465bf35 Mon Sep 17 00:00:00 2001 From: Tim Martin Date: Tue, 18 Jun 2019 11:20:48 +0100 Subject: [PATCH] Load reverse from the new location for Django 2.x compatibility --- src/shorturls/templatetags/shorturl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/shorturls/templatetags/shorturl.py b/src/shorturls/templatetags/shorturl.py index 6009425..caed2f1 100644 --- a/src/shorturls/templatetags/shorturl.py +++ b/src/shorturls/templatetags/shorturl.py @@ -2,7 +2,7 @@ from django import template from django.conf import settings -from django.core import urlresolvers +from django.urls import reverse, NoReverseMatch from django.utils.safestring import mark_safe from shorturls import default_converter as converter, views @@ -37,11 +37,11 @@ def render(self, context): return urljoin(settings.SHORT_BASE_URL, prefix + tinyid) try: - return urlresolvers.reverse(views.redirect, kwargs={ + return reverse(views.redirect, kwargs={ 'prefix': prefix, 'tiny': tinyid }) - except urlresolvers.NoReverseMatch: + except NoReverseMatch: return '' def get_prefix(self, model):