mirror of https://github.com/django/django.git
[1.7.x] Fixed #22940 -- Added missing string iterpolation parameters in migrations.writer error.
This commit is contained in:
parent
a56773245b
commit
f5740af868
1
AUTHORS
1
AUTHORS
|
@ -674,6 +674,7 @@ answer newbie questions, and generally made Django that much better:
|
||||||
Jakub Wiśniowski <restless.being@gmail.com>
|
Jakub Wiśniowski <restless.being@gmail.com>
|
||||||
Maciej Wiśniowski <pigletto@gmail.com>
|
Maciej Wiśniowski <pigletto@gmail.com>
|
||||||
wojtek
|
wojtek
|
||||||
|
Colin Wood <cwood06@gmail.com>
|
||||||
Marcin Wróbel
|
Marcin Wróbel
|
||||||
Jason Yan <tailofthesun@gmail.com>
|
Jason Yan <tailofthesun@gmail.com>
|
||||||
Lars Yencken <lars.yencken@gmail.com>
|
Lars Yencken <lars.yencken@gmail.com>
|
||||||
|
|
|
@ -319,7 +319,7 @@ class MigrationWriter(object):
|
||||||
"and used in the same class body). Please move the "
|
"and used in the same class body). Please move the "
|
||||||
"function into the main module body to use migrations.\n"
|
"function into the main module body to use migrations.\n"
|
||||||
"For more information, see https://docs.djangoproject.com/en/1.7/topics/migrations/#serializing-values"
|
"For more information, see https://docs.djangoproject.com/en/1.7/topics/migrations/#serializing-values"
|
||||||
)
|
% (value.__name__, module_name))
|
||||||
return "%s.%s" % (module_name, value.__name__), set(["import %s" % module_name])
|
return "%s.%s" % (module_name, value.__name__), set(["import %s" % module_name])
|
||||||
# Classes
|
# Classes
|
||||||
elif isinstance(value, type):
|
elif isinstance(value, type):
|
||||||
|
|
|
@ -167,6 +167,19 @@ class WriterTests(TestCase):
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
self.serialize_round_trip(TestModel2.thing)
|
self.serialize_round_trip(TestModel2.thing)
|
||||||
|
|
||||||
|
def test_serialize_local_function_reference_message(self):
|
||||||
|
"""
|
||||||
|
Make sure user is seeing which module/function is the issue
|
||||||
|
"""
|
||||||
|
class TestModel2(object):
|
||||||
|
def upload_to(self):
|
||||||
|
return "somewhere dynamic"
|
||||||
|
thing = models.FileField(upload_to=upload_to)
|
||||||
|
|
||||||
|
with six.assertRaisesRegex(self, ValueError,
|
||||||
|
'^Could not find function upload_to in migrations.test_writer'):
|
||||||
|
self.serialize_round_trip(TestModel2.thing)
|
||||||
|
|
||||||
def test_simple_migration(self):
|
def test_simple_migration(self):
|
||||||
"""
|
"""
|
||||||
Tests serializing a simple migration.
|
Tests serializing a simple migration.
|
||||||
|
|
Loading…
Reference in New Issue