Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.0.X] Fixed #9706: made SlugField honor max_length in Oracle, match…

…ing the other backends. Backport of [9548] from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9549 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a261602bd3e9e2e76559ce4257bf32ce95b71d54 1 parent 4c7efda
Ian Kelly authored December 02, 2008
2  django/db/backends/oracle/creation.py
@@ -32,7 +32,7 @@ class DatabaseCreation(BaseDatabaseCreation):
32 32
         'OneToOneField':                'NUMBER(11)',
33 33
         'PositiveIntegerField':         'NUMBER(11) CHECK (%(qn_column)s >= 0)',
34 34
         'PositiveSmallIntegerField':    'NUMBER(11) CHECK (%(qn_column)s >= 0)',
35  
-        'SlugField':                    'NVARCHAR2(50)',
  35
+        'SlugField':                    'NVARCHAR2(%(max_length)s)',
36 36
         'SmallIntegerField':            'NUMBER(11)',
37 37
         'TextField':                    'NCLOB',
38 38
         'TimeField':                    'TIMESTAMP',
9  tests/regressiontests/model_fields/models.py
@@ -36,6 +36,9 @@ class Whiz(models.Model):
36 36
 class BigD(models.Model):
37 37
     d = models.DecimalField(max_digits=38, decimal_places=30)
38 38
 
  39
+class BigS(models.Model):
  40
+    s = models.SlugField(max_length=255)
  41
+
39 42
 __test__ = {'API_TESTS':"""
40 43
 # Create a couple of Places.
41 44
 >>> f = Foo.objects.create(a='abc', d=decimal.Decimal("12.34"))
@@ -88,4 +91,10 @@ class BigD(models.Model):
88 91
 >>> bd = BigD.objects.get(pk=bd.pk)
89 92
 >>> bd.d == decimal.Decimal("12.9")
90 93
 True
  94
+
  95
+# Regression test for #9706: ensure SlugField honors max_length.
  96
+>>> bs = BigS.objects.create(s = 'slug' * 50)
  97
+>>> bs = BigS.objects.get(pk=bs.pk)
  98
+>>> bs.s == 'slug' * 50
  99
+True
91 100
 """}

0 notes on commit a261602

Please sign in to comment.
Something went wrong with that request. Please try again.