From 7a61c68c50d3837c50e35c252fd76220f08b5290 Mon Sep 17 00:00:00 2001 From: Jason Myers Date: Sat, 2 Nov 2013 23:36:09 -0500 Subject: PEP8 cleanup Signed-off-by: Jason Myers --- tests/model_forms/models.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests/model_forms') diff --git a/tests/model_forms/models.py b/tests/model_forms/models.py index 34644a4bb9..72bf1ff26a 100644 --- a/tests/model_forms/models.py +++ b/tests/model_forms/models.py @@ -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], -- cgit v1.3