Skip to content

Commit

Permalink
Fixed #9706: made SlugField honor max_length in Oracle, matching the …
Browse files Browse the repository at this point in the history
…other backends.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9548 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
nightflyerkilo committed Dec 2, 2008
1 parent 4853160 commit 4637a77
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion django/db/backends/oracle/creation.py
Expand Up @@ -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',
Expand Down
9 changes: 9 additions & 0 deletions tests/regressiontests/model_fields/models.py
Expand Up @@ -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"))
Expand Down Expand Up @@ -88,4 +91,10 @@ class BigD(models.Model):
>>> 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
"""}

0 comments on commit 4637a77

Please sign in to comment.