diff --git a/django/db/backends/oracle/creation.py b/django/db/backends/oracle/creation.py index 648c42f3ea..bff7e1bea5 100644 --- a/django/db/backends/oracle/creation.py +++ b/django/db/backends/oracle/creation.py @@ -32,7 +32,7 @@ class DatabaseCreation(BaseDatabaseCreation): 'OneToOneField': 'NUMBER(11)', 'PositiveIntegerField': 'NUMBER(11) CHECK (%(qn_column)s >= 0)', 'PositiveSmallIntegerField': 'NUMBER(11) CHECK (%(qn_column)s >= 0)', - 'SlugField': 'NVARCHAR2(50)', + 'SlugField': 'NVARCHAR2(%(max_length)s)', 'SmallIntegerField': 'NUMBER(11)', 'TextField': 'NCLOB', 'TimeField': 'TIMESTAMP', diff --git a/tests/regressiontests/model_fields/models.py b/tests/regressiontests/model_fields/models.py index a1c2bb0bc8..6948fe51a5 100644 --- a/tests/regressiontests/model_fields/models.py +++ b/tests/regressiontests/model_fields/models.py @@ -36,6 +36,9 @@ class Whiz(models.Model): class BigD(models.Model): d = models.DecimalField(max_digits=38, decimal_places=30) +class BigS(models.Model): + s = models.SlugField(max_length=255) + __test__ = {'API_TESTS':""" # Create a couple of Places. >>> f = Foo.objects.create(a='abc', d=decimal.Decimal("12.34")) @@ -88,4 +91,10 @@ u'' >>> bd = BigD.objects.get(pk=bd.pk) >>> bd.d == decimal.Decimal("12.9") True + +# Regression test for #9706: ensure SlugField honors max_length. +>>> bs = BigS.objects.create(s = 'slug' * 50) +>>> bs = BigS.objects.get(pk=bs.pk) +>>> bs.s == 'slug' * 50 +True """}