mirror of https://github.com/django/django.git
Fixed #30350 -- Prevented recreation of migration for operations with a range object.
Thanks to Mariusz Felisiak for helping with the patch.
This commit is contained in:
parent
1afbc96a75
commit
2e38f2015a
|
@ -284,7 +284,7 @@ class Serializer:
|
|||
(datetime.date, datetime.timedelta, datetime.time): DateTimeSerializer,
|
||||
SettingsReference: SettingsReferenceSerializer,
|
||||
float: FloatSerializer,
|
||||
(bool, int, type(None), bytes, str): BaseSimpleSerializer,
|
||||
(bool, int, type(None), bytes, str, range): BaseSimpleSerializer,
|
||||
decimal.Decimal: DecimalSerializer,
|
||||
(functools.partial, functools.partialmethod): FunctoolsPartialSerializer,
|
||||
(types.FunctionType, types.BuiltinFunctionType, types.MethodType): FunctionTypeSerializer,
|
||||
|
|
|
@ -25,3 +25,7 @@ Bugfixes
|
|||
|
||||
* Fixed a regression in Django 2.2 that caused a single instance fast-delete
|
||||
to not set the primary key to ``None`` (:ticket:`30330`).
|
||||
|
||||
* Prevented :djadmin:`makemigrations` from generating infinite migrations for
|
||||
check constraints and partial indexes when ``condition`` contains
|
||||
a :class:`~python:range` object (:ticket:`30350`).
|
||||
|
|
|
@ -451,6 +451,11 @@ class WriterTests(SimpleTestCase):
|
|||
self.assertSerializedEqual(one_item_tuple)
|
||||
self.assertSerializedEqual(many_items_tuple)
|
||||
|
||||
def test_serialize_range(self):
|
||||
string, imports = MigrationWriter.serialize(range(1, 5))
|
||||
self.assertEqual(string, 'range(1, 5)')
|
||||
self.assertEqual(imports, set())
|
||||
|
||||
def test_serialize_builtins(self):
|
||||
string, imports = MigrationWriter.serialize(range)
|
||||
self.assertEqual(string, 'range')
|
||||
|
|
Loading…
Reference in New Issue