From d611a89238b0fe69ccb8a0e7bf20672015357128 Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Wed, 10 May 2017 17:33:46 +0200 Subject: [PATCH] Decreased max_length for char fields unless absolutely needed. (#8485) --- tests/defer_regress/models.py | 12 ++++++------ tests/foreign_object/models/article.py | 2 +- tests/generic_views/models.py | 4 ++-- tests/get_or_create/models.py | 2 +- tests/model_fields/models.py | 2 +- tests/model_inheritance_regress/models.py | 2 +- tests/servers/models.py | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/defer_regress/models.py b/tests/defer_regress/models.py index 55eac8c537..8b05fc4130 100644 --- a/tests/defer_regress/models.py +++ b/tests/defer_regress/models.py @@ -76,11 +76,11 @@ class ItemAndSimpleItem(models.Model): class Profile(models.Model): - profile1 = models.CharField(max_length=1000, default='profile1') + profile1 = models.CharField(max_length=255, default='profile1') class Location(models.Model): - location1 = models.CharField(max_length=1000, default='location1') + location1 = models.CharField(max_length=255, default='location1') class Request(models.Model): @@ -88,10 +88,10 @@ class Request(models.Model): location = models.ForeignKey(Location, models.CASCADE) items = models.ManyToManyField(Item) - request1 = models.CharField(default='request1', max_length=1000) - request2 = models.CharField(default='request2', max_length=1000) - request3 = models.CharField(default='request3', max_length=1000) - request4 = models.CharField(default='request4', max_length=1000) + request1 = models.CharField(default='request1', max_length=255) + request2 = models.CharField(default='request2', max_length=255) + request3 = models.CharField(default='request3', max_length=255) + request4 = models.CharField(default='request4', max_length=255) class Base(models.Model): diff --git a/tests/foreign_object/models/article.py b/tests/foreign_object/models/article.py index 851029efa1..103661a4a3 100644 --- a/tests/foreign_object/models/article.py +++ b/tests/foreign_object/models/article.py @@ -83,7 +83,7 @@ class ArticleTranslation(models.Model): lang = models.CharField(max_length=2) title = models.CharField(max_length=100) body = models.TextField() - abstract = models.CharField(max_length=400, null=True) + abstract = models.TextField(null=True) class Meta: unique_together = ('article', 'lang') diff --git a/tests/generic_views/models.py b/tests/generic_views/models.py index 8f806b9a85..5733e44093 100644 --- a/tests/generic_views/models.py +++ b/tests/generic_views/models.py @@ -39,7 +39,7 @@ DoesNotExistBookManager = BaseManager.from_queryset(DoesNotExistQuerySet) class Book(models.Model): - name = models.CharField(max_length=300) + name = models.CharField(max_length=255) slug = models.SlugField() pages = models.IntegerField() authors = models.ManyToManyField(Author) @@ -57,7 +57,7 @@ class Book(models.Model): class Page(models.Model): content = models.TextField() - template = models.CharField(max_length=300) + template = models.CharField(max_length=255) class BookSigning(models.Model): diff --git a/tests/get_or_create/models.py b/tests/get_or_create/models.py index cfde80ce85..865798ae98 100644 --- a/tests/get_or_create/models.py +++ b/tests/get_or_create/models.py @@ -29,7 +29,7 @@ class Tag(models.Model): class Thing(models.Model): - name = models.CharField(max_length=256) + name = models.CharField(max_length=255) tags = models.ManyToManyField(Tag) diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py index f6e94a841e..2208a8d4b8 100644 --- a/tests/model_fields/models.py +++ b/tests/model_fields/models.py @@ -74,7 +74,7 @@ class WhizIterEmpty(models.Model): class BigD(models.Model): - d = models.DecimalField(max_digits=38, decimal_places=30) + d = models.DecimalField(max_digits=32, decimal_places=30) class FloatModel(models.Model): diff --git a/tests/model_inheritance_regress/models.py b/tests/model_inheritance_regress/models.py index 358217554b..5e4c928dc9 100644 --- a/tests/model_inheritance_regress/models.py +++ b/tests/model_inheritance_regress/models.py @@ -193,7 +193,7 @@ class MessyBachelorParty(BachelorParty): # Check concrete -> abstract -> concrete inheritance class SearchableLocation(models.Model): - keywords = models.CharField(max_length=256) + keywords = models.CharField(max_length=255) class Station(SearchableLocation): diff --git a/tests/servers/models.py b/tests/servers/models.py index 6e1414ae19..b523bae6f2 100644 --- a/tests/servers/models.py +++ b/tests/servers/models.py @@ -2,4 +2,4 @@ from django.db import models class Person(models.Model): - name = models.CharField(max_length=256) + name = models.CharField(max_length=255)