Refs -- Added test for serializing psycopg2's NumericRange with DecimalRangeField in migrations.
+from decimal import Decimal
+
from django.db.backends.signals import connection_created
from django.db.migrations.writer import MigrationWriter
from django.test.utils import modify_settings
@@ -10,7 +12,8 @@ try:
)
from django.contrib.postgres.fields import (
- DateRangeField, DateTimeRangeField, IntegerRangeField,
+ DateRangeField, DateTimeRangeField, DecimalRangeField,
+ IntegerRangeField,
)
except ImportError:
pass
@@ -29,6 +32,7 @@ class PostgresConfigTests(PostgreSQLTestCase):
(DateRange(empty=True), DateRangeField),
(DateTimeRange(empty=True), DateRangeField),
(DateTimeTZRange(None, None, '[]'), DateTimeRangeField),
+ (NumericRange(Decimal('1.0'), Decimal('5.0'), '()'), DecimalRangeField),
(NumericRange(1, 10), IntegerRangeField),
)
