Make sure that all uses of max_length in the test suite use values smaller than 255. If we use max_length > 255 the test suite can't be run on MySQL 4.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10697 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2009-05-07 18:06:22 +00:00
parent a59095af24
commit 7caf21aa2e
5 changed files with 16 additions and 16 deletions

View File

@ -15,7 +15,7 @@ class Author(models.Model):
return self.name return self.name
class Publisher(models.Model): class Publisher(models.Model):
name = models.CharField(max_length=300) name = models.CharField(max_length=255)
num_awards = models.IntegerField() num_awards = models.IntegerField()
def __unicode__(self): def __unicode__(self):
@ -23,7 +23,7 @@ class Publisher(models.Model):
class Book(models.Model): class Book(models.Model):
isbn = models.CharField(max_length=9) isbn = models.CharField(max_length=9)
name = models.CharField(max_length=300) name = models.CharField(max_length=255)
pages = models.IntegerField() pages = models.IntegerField()
rating = models.FloatField() rating = models.FloatField()
price = models.DecimalField(decimal_places=2, max_digits=6) price = models.DecimalField(decimal_places=2, max_digits=6)
@ -36,7 +36,7 @@ class Book(models.Model):
return self.name return self.name
class Store(models.Model): class Store(models.Model):
name = models.CharField(max_length=300) name = models.CharField(max_length=255)
books = models.ManyToManyField(Book) books = models.ManyToManyField(Book)
original_opening = models.DateTimeField() original_opening = models.DateTimeField()
friday_night_closing = models.TimeField() friday_night_closing = models.TimeField()

View File

@ -18,7 +18,7 @@ class Author(models.Model):
return self.name return self.name
class Publisher(models.Model): class Publisher(models.Model):
name = models.CharField(max_length=300) name = models.CharField(max_length=255)
num_awards = models.IntegerField() num_awards = models.IntegerField()
def __unicode__(self): def __unicode__(self):
@ -26,7 +26,7 @@ class Publisher(models.Model):
class Book(models.Model): class Book(models.Model):
isbn = models.CharField(max_length=9) isbn = models.CharField(max_length=9)
name = models.CharField(max_length=300) name = models.CharField(max_length=255)
pages = models.IntegerField() pages = models.IntegerField()
rating = models.FloatField() rating = models.FloatField()
price = models.DecimalField(decimal_places=2, max_digits=6) price = models.DecimalField(decimal_places=2, max_digits=6)
@ -42,7 +42,7 @@ class Book(models.Model):
return self.name return self.name
class Store(models.Model): class Store(models.Model):
name = models.CharField(max_length=300) name = models.CharField(max_length=255)
books = models.ManyToManyField(Book) books = models.ManyToManyField(Book)
original_opening = models.DateTimeField() original_opening = models.DateTimeField()
friday_night_closing = models.TimeField() friday_night_closing = models.TimeField()

View File

@ -16,7 +16,7 @@ class BoundaryModel(models.Model):
positive_integer = models.PositiveIntegerField(null=True, blank=True) positive_integer = models.PositiveIntegerField(null=True, blank=True)
class Defaults(models.Model): class Defaults(models.Model):
name = models.CharField(max_length=256, default='class default value') name = models.CharField(max_length=255, default='class default value')
def_date = models.DateField(default = datetime.date(1980, 1, 1)) def_date = models.DateField(default = datetime.date(1980, 1, 1))
value = models.IntegerField(default=42) value = models.IntegerField(default=42)
@ -88,7 +88,7 @@ datetime.date(1969, 4, 4)
>>> from django.forms import CharField >>> from django.forms import CharField
>>> class ExcludingForm(ModelForm): >>> class ExcludingForm(ModelForm):
... name = CharField(max_length=256) ... name = CharField(max_length=255)
... class Meta: ... class Meta:
... model = Defaults ... model = Defaults
... exclude = ['name'] ... exclude = ['name']

View File

@ -7,7 +7,7 @@ class PersonWithDefaultMaxLengths(models.Model):
avatar = models.FilePathField() avatar = models.FilePathField()
class PersonWithCustomMaxLengths(models.Model): class PersonWithCustomMaxLengths(models.Model):
email = models.EmailField(max_length=384) email = models.EmailField(max_length=250)
vcard = models.FileField(upload_to='/tmp', max_length=1024) vcard = models.FileField(upload_to='/tmp', max_length=250)
homepage = models.URLField(max_length=256) homepage = models.URLField(max_length=250)
avatar = models.FilePathField(max_length=512) avatar = models.FilePathField(max_length=250)

View File

@ -14,10 +14,10 @@ class MaxLengthArgumentsTests(TestCase):
self.verify_max_length(PersonWithDefaultMaxLengths, 'avatar', 100) self.verify_max_length(PersonWithDefaultMaxLengths, 'avatar', 100)
def test_custom_max_lengths(self): def test_custom_max_lengths(self):
self.verify_max_length(PersonWithCustomMaxLengths, 'email', 384) self.verify_max_length(PersonWithCustomMaxLengths, 'email', 250)
self.verify_max_length(PersonWithCustomMaxLengths, 'vcard', 1024) self.verify_max_length(PersonWithCustomMaxLengths, 'vcard', 250)
self.verify_max_length(PersonWithCustomMaxLengths, 'homepage', 256) self.verify_max_length(PersonWithCustomMaxLengths, 'homepage', 250)
self.verify_max_length(PersonWithCustomMaxLengths, 'avatar', 512) self.verify_max_length(PersonWithCustomMaxLengths, 'avatar', 250)
class MaxLengthORMTests(TestCase): class MaxLengthORMTests(TestCase):