Decreased max_length for char fields unless absolutely needed. (#8485)

This commit is contained in:
Florian Apolloner 2017-05-10 17:33:46 +02:00 committed by GitHub
parent 60f5129076
commit d611a89238
7 changed files with 13 additions and 13 deletions

View File

@ -76,11 +76,11 @@ class ItemAndSimpleItem(models.Model):
class Profile(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): class Location(models.Model):
location1 = models.CharField(max_length=1000, default='location1') location1 = models.CharField(max_length=255, default='location1')
class Request(models.Model): class Request(models.Model):
@ -88,10 +88,10 @@ class Request(models.Model):
location = models.ForeignKey(Location, models.CASCADE) location = models.ForeignKey(Location, models.CASCADE)
items = models.ManyToManyField(Item) items = models.ManyToManyField(Item)
request1 = models.CharField(default='request1', max_length=1000) request1 = models.CharField(default='request1', max_length=255)
request2 = models.CharField(default='request2', max_length=1000) request2 = models.CharField(default='request2', max_length=255)
request3 = models.CharField(default='request3', max_length=1000) request3 = models.CharField(default='request3', max_length=255)
request4 = models.CharField(default='request4', max_length=1000) request4 = models.CharField(default='request4', max_length=255)
class Base(models.Model): class Base(models.Model):

View File

@ -83,7 +83,7 @@ class ArticleTranslation(models.Model):
lang = models.CharField(max_length=2) lang = models.CharField(max_length=2)
title = models.CharField(max_length=100) title = models.CharField(max_length=100)
body = models.TextField() body = models.TextField()
abstract = models.CharField(max_length=400, null=True) abstract = models.TextField(null=True)
class Meta: class Meta:
unique_together = ('article', 'lang') unique_together = ('article', 'lang')

View File

@ -39,7 +39,7 @@ DoesNotExistBookManager = BaseManager.from_queryset(DoesNotExistQuerySet)
class Book(models.Model): class Book(models.Model):
name = models.CharField(max_length=300) name = models.CharField(max_length=255)
slug = models.SlugField() slug = models.SlugField()
pages = models.IntegerField() pages = models.IntegerField()
authors = models.ManyToManyField(Author) authors = models.ManyToManyField(Author)
@ -57,7 +57,7 @@ class Book(models.Model):
class Page(models.Model): class Page(models.Model):
content = models.TextField() content = models.TextField()
template = models.CharField(max_length=300) template = models.CharField(max_length=255)
class BookSigning(models.Model): class BookSigning(models.Model):

View File

@ -29,7 +29,7 @@ class Tag(models.Model):
class Thing(models.Model): class Thing(models.Model):
name = models.CharField(max_length=256) name = models.CharField(max_length=255)
tags = models.ManyToManyField(Tag) tags = models.ManyToManyField(Tag)

View File

@ -74,7 +74,7 @@ class WhizIterEmpty(models.Model):
class BigD(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): class FloatModel(models.Model):

View File

@ -193,7 +193,7 @@ class MessyBachelorParty(BachelorParty):
# Check concrete -> abstract -> concrete inheritance # Check concrete -> abstract -> concrete inheritance
class SearchableLocation(models.Model): class SearchableLocation(models.Model):
keywords = models.CharField(max_length=256) keywords = models.CharField(max_length=255)
class Station(SearchableLocation): class Station(SearchableLocation):

View File

@ -2,4 +2,4 @@ from django.db import models
class Person(models.Model): class Person(models.Model):
name = models.CharField(max_length=256) name = models.CharField(max_length=255)