Skip to content

Commit 853b80b

Browse files
committed
django 1.5.1 compat and test fix
1 parent 36c9102 commit 853b80b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

concurrency/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def message_user(self, request, message, **kwargs):
198198
opts = self.model._meta
199199
if self._concurrency_list_editable_errors:
200200
names = force_unicode(opts.verbose_name), force_unicode(opts.verbose_name_plural)
201-
pattern = ur"(?P<num>\d+) ({0}|{1})".format(*names)
201+
pattern = r"(?P<num>\d+) ({0}|{1})".format(*names)
202202
rex = re.compile(pattern)
203203
m = rex.match(message)
204204
concurrency_errros = len(self._concurrency_list_editable_errors)

concurrency/tests/admin_list_editable.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# -*- coding: utf-8 -*-
2-
from concurrency.tests.base import AdminTestCase, SENTINEL
3-
from concurrency.tests.models import ListEditableConcurrentModel, NoActionsConcurrentModel
2+
from __future__ import absolute_import, unicode_literals
43
from django.contrib.admin.models import LogEntry
54
from django.contrib.contenttypes.models import ContentType
5+
from django.utils.encoding import force_unicode
6+
7+
from concurrency.tests.base import AdminTestCase, SENTINEL
8+
from concurrency.tests.models import ListEditableConcurrentModel, NoActionsConcurrentModel
69

710

811
class TestListEditable(AdminTestCase):
@@ -56,7 +59,7 @@ def test_message_user(self):
5659

5760
self.assertIn('Record with pk `1` has been modified and was not updated',
5861
messages)
59-
self.assertIn('1 ListEditable-ConcurrentModel was changed successfully.',
62+
self.assertIn('1 %s was changed successfully.' % force_unicode(self.TARGET._meta.verbose_name),
6063
messages)
6164

6265
def test_message_user_no_changes(self):
@@ -71,7 +74,7 @@ def test_message_user_no_changes(self):
7174

7275
messages = map(str, list(res.context['messages']))
7376

74-
self.assertIn('No ListEditable-ConcurrentModel were changed due conflict errors',
77+
self.assertIn('No %s were changed due conflict errors' % force_unicode(self.TARGET._meta.verbose_name),
7578
messages)
7679
self.assertEqual(len(messages), 1)
7780

0 commit comments

Comments
 (0)