Skip to content

Commit fe2d478

Browse files
committed
Removed usage of django's deprecated @models.permalink decorator
1 parent fdfae9d commit fe2d478

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

simple_history/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from django.contrib import admin
1010
from django.db import models, router
1111
from django.db.models.fields.proxy import OrderWrt
12+
from django.urls import reverse
1213
from django.utils import six
1314
from django.utils.encoding import python_2_unicode_compatible, smart_text
1415
from django.utils.timezone import now
@@ -206,14 +207,13 @@ def get_extra_fields(self, model, fields):
206207

207208
user_model = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
208209

209-
@models.permalink
210210
def revert_url(self):
211211
"""URL for this change in the default admin site."""
212212
opts = model._meta
213213
app_label, model_name = opts.app_label, opts.model_name
214-
return ('%s:%s_%s_simple_history' %
214+
return reverse('%s:%s_%s_simple_history' %
215215
(admin.site.name, app_label, model_name),
216-
[getattr(self, opts.pk.attname), self.history_id])
216+
args=[getattr(self, opts.pk.attname), self.history_id])
217217

218218
def get_instance(self):
219219
return model(**{

0 commit comments

Comments
 (0)