mirror of
https://github.com/django/django.git
synced 2025-08-02 18:13:02 +00:00
PEP8 cleanup
Signed-off-by: Jason Myers <jason@jasonamyers.com>
This commit is contained in:
parent
0fdb692c6c
commit
7a61c68c50
128 changed files with 739 additions and 206 deletions
|
@ -34,6 +34,7 @@ ARTICLE_STATUS_CHAR = (
|
|||
('l', 'Live'),
|
||||
)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Category(models.Model):
|
||||
name = models.CharField(max_length=20)
|
||||
|
@ -46,6 +47,7 @@ class Category(models.Model):
|
|||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Writer(models.Model):
|
||||
name = models.CharField(max_length=50, help_text='Use both first and last names.')
|
||||
|
@ -56,6 +58,7 @@ class Writer(models.Model):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Article(models.Model):
|
||||
headline = models.CharField(max_length=50)
|
||||
|
@ -76,15 +79,19 @@ class Article(models.Model):
|
|||
def __str__(self):
|
||||
return self.headline
|
||||
|
||||
|
||||
class ImprovedArticle(models.Model):
|
||||
article = models.OneToOneField(Article)
|
||||
|
||||
|
||||
class ImprovedArticleWithParentLink(models.Model):
|
||||
article = models.OneToOneField(Article, parent_link=True)
|
||||
|
||||
|
||||
class BetterWriter(Writer):
|
||||
score = models.IntegerField()
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class WriterProfile(models.Model):
|
||||
writer = models.OneToOneField(Writer, primary_key=True)
|
||||
|
@ -93,6 +100,7 @@ class WriterProfile(models.Model):
|
|||
def __str__(self):
|
||||
return "%s is %s" % (self.writer, self.age)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class TextFile(models.Model):
|
||||
description = models.CharField(max_length=20)
|
||||
|
@ -144,6 +152,7 @@ try:
|
|||
except ImproperlyConfigured:
|
||||
test_images = False
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class CommaSeparatedInteger(models.Model):
|
||||
field = models.CommaSeparatedIntegerField(max_length=20)
|
||||
|
@ -151,6 +160,7 @@ class CommaSeparatedInteger(models.Model):
|
|||
def __str__(self):
|
||||
return self.field
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Product(models.Model):
|
||||
slug = models.SlugField(unique=True)
|
||||
|
@ -158,6 +168,7 @@ class Product(models.Model):
|
|||
def __str__(self):
|
||||
return self.slug
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Price(models.Model):
|
||||
price = models.DecimalField(max_digits=10, decimal_places=2)
|
||||
|
@ -169,9 +180,11 @@ class Price(models.Model):
|
|||
class Meta:
|
||||
unique_together = (('price', 'quantity'),)
|
||||
|
||||
|
||||
class ArticleStatus(models.Model):
|
||||
status = models.CharField(max_length=2, choices=ARTICLE_STATUS_CHAR, blank=True, null=True)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Inventory(models.Model):
|
||||
barcode = models.PositiveIntegerField(unique=True)
|
||||
|
@ -187,6 +200,7 @@ class Inventory(models.Model):
|
|||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
|
||||
class Book(models.Model):
|
||||
title = models.CharField(max_length=40)
|
||||
author = models.ForeignKey(Writer, blank=True, null=True)
|
||||
|
@ -195,6 +209,7 @@ class Book(models.Model):
|
|||
class Meta:
|
||||
unique_together = ('title', 'author')
|
||||
|
||||
|
||||
class BookXtra(models.Model):
|
||||
isbn = models.CharField(max_length=16, unique=True)
|
||||
suffix1 = models.IntegerField(blank=True, default=0)
|
||||
|
@ -204,9 +219,11 @@ class BookXtra(models.Model):
|
|||
unique_together = (('suffix1', 'suffix2'))
|
||||
abstract = True
|
||||
|
||||
|
||||
class DerivedBook(Book, BookXtra):
|
||||
pass
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class ExplicitPK(models.Model):
|
||||
key = models.CharField(max_length=20, primary_key=True)
|
||||
|
@ -218,6 +235,7 @@ class ExplicitPK(models.Model):
|
|||
def __str__(self):
|
||||
return self.key
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Post(models.Model):
|
||||
title = models.CharField(max_length=50, unique_for_date='posted', blank=True)
|
||||
|
@ -228,6 +246,7 @@ class Post(models.Model):
|
|||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class DateTimePost(models.Model):
|
||||
title = models.CharField(max_length=50, unique_for_date='posted', blank=True)
|
||||
|
@ -238,9 +257,11 @@ class DateTimePost(models.Model):
|
|||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
|
||||
class DerivedPost(Post):
|
||||
pass
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class BigInt(models.Model):
|
||||
biggie = models.BigIntegerField()
|
||||
|
@ -248,6 +269,7 @@ class BigInt(models.Model):
|
|||
def __str__(self):
|
||||
return six.text_type(self.biggie)
|
||||
|
||||
|
||||
class MarkupField(models.CharField):
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs["max_length"] = 20
|
||||
|
@ -260,16 +282,19 @@ class MarkupField(models.CharField):
|
|||
# regressed at r10062
|
||||
return None
|
||||
|
||||
|
||||
class CustomFieldForExclusionModel(models.Model):
|
||||
name = models.CharField(max_length=10)
|
||||
markup = MarkupField()
|
||||
|
||||
|
||||
class FlexibleDatePost(models.Model):
|
||||
title = models.CharField(max_length=50, unique_for_date='posted', blank=True)
|
||||
slug = models.CharField(max_length=50, unique_for_year='posted', blank=True)
|
||||
subtitle = models.CharField(max_length=50, unique_for_month='posted', blank=True)
|
||||
posted = models.DateField(blank=True, null=True)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Colour(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
|
@ -281,14 +306,17 @@ class Colour(models.Model):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class ColourfulItem(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
colours = models.ManyToManyField(Colour)
|
||||
|
||||
|
||||
class ArticleStatusNote(models.Model):
|
||||
name = models.CharField(max_length=20)
|
||||
status = models.ManyToManyField(ArticleStatus)
|
||||
|
||||
|
||||
class CustomErrorMessage(models.Model):
|
||||
name1 = models.CharField(max_length=50,
|
||||
validators=[validators.validate_slug],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue