Skip to content

Commit

Permalink
Admin mark_safe issue. Fxes #46
Browse files Browse the repository at this point in the history
Changed to `mark_safe` because `allow_tags` is deprecated in Django 2+.
  • Loading branch information
Tamas Szabo committed Jun 25, 2018
1 parent 2919872 commit 5a9284d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
7 changes: 3 additions & 4 deletions iprestrict/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from django.db import models
from django.utils import timezone
from django.utils.safestring import mark_safe

try:
from django.urls import reverse
Expand Down Expand Up @@ -253,14 +254,12 @@ def move_up(self):

def move_up_url(self):
url = reverse('iprestrict:move_rule_up', args=[self.pk])
return '<a href="%s">Move Up</a>' % url
move_up_url.allow_tags = True
return mark_safe('<a href="%s">Move Up</a>' % url)
move_up_url.short_description = 'Move Up'

def move_down_url(self):
url = reverse('iprestrict:move_rule_down', args=[self.pk])
return '<a href="%s">Move Down</a>' % url
move_down_url.allow_tags = True
return mark_safe('<a href="%s">Move Down</a>' % url)
move_down_url.short_description = 'Move Down'

def move_down(self):
Expand Down
2 changes: 2 additions & 0 deletions requirements-1_11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r common-requirements.txt
Django>=1.11,<1.12
2 changes: 1 addition & 1 deletion requirements.txt
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
{py27,py34,py35,py36}-django-{18,19,110}
{py27,py34,py35,py36}-django-{18,19,110,111}
{py34,py35,py36}-django-{20}
flake8
skip_missing_interpreters = True
Expand Down

0 comments on commit 5a9284d

Please sign in to comment.